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 {
2012-09-19 12:07:39 +02:00
public function __construct ( $message , $parser ) {
2011-02-09 05:31:16 +01:00
$prior = substr ( $parser -> string , 0 , $parser -> pos );
preg_match_all ( '/\r\n|\r|\n/' , $prior , $matches );
$line = count ( $matches [ 0 ]) + 1 ;
parent :: __construct ( " Parse error in template on line $line . Error was: $message " );
}
}
/**
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
*/
2012-09-19 12:07:39 +02:00
public function construct ( $matchrule , $name , $arguments = null ) {
2011-02-28 04:12:41 +01:00
$res = parent :: construct ( $matchrule , $name , $arguments );
if ( ! isset ( $res [ 'php' ])) $res [ 'php' ] = '' ;
return $res ;
}
2012-04-16 07:37:57 +02:00
/* Template: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock | OpenBlock | MalformedBlock | Injection | Text)+ */
2011-02-28 04:12:41 +01:00
protected $match_Template_typestack = array ( 'Template' );
2012-09-19 12:07:39 +02:00
public function match_Template ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " Template " ; $result = $this -> construct ( $matchrule , $matchrule , null );
$count = 0 ;
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_50 = $result ;
$pos_50 = $this -> pos ;
$_49 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$_47 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_0 = $result ;
$pos_0 = $this -> pos ;
$matcher = 'match_' . 'Comment' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_47 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_0 ;
$this -> pos = $pos_0 ;
2012-04-16 07:37:57 +02:00
$_45 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_2 = $result ;
$pos_2 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'Translate' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_45 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_2 ;
$this -> pos = $pos_2 ;
2012-04-16 07:37:57 +02:00
$_43 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_4 = $result ;
$pos_4 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'If' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_43 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_4 ;
$this -> pos = $pos_4 ;
2012-04-16 07:37:57 +02:00
$_41 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_6 = $result ;
$pos_6 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'Require' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_41 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_6 ;
$this -> pos = $pos_6 ;
2012-04-16 07:37:57 +02:00
$_39 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_8 = $result ;
$pos_8 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'CacheBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_39 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_8 ;
$this -> pos = $pos_8 ;
2012-04-16 07:37:57 +02:00
$_37 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_10 = $result ;
$pos_10 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'UncachedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_37 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_10 ;
$this -> pos = $pos_10 ;
2012-04-16 07:37:57 +02:00
$_35 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_12 = $result ;
$pos_12 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'OldI18NTag' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_35 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_12 ;
$this -> pos = $pos_12 ;
2012-04-16 07:37:57 +02:00
$_33 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_14 = $result ;
$pos_14 = $this -> pos ;
2012-04-16 07:37:57 +02:00
$matcher = 'match_' . 'Include' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_33 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_14 ;
$this -> pos = $pos_14 ;
2012-04-16 07:37:57 +02:00
$_31 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_16 = $result ;
$pos_16 = $this -> pos ;
2012-04-16 07:37:57 +02:00
$matcher = 'match_' . 'ClosedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_31 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_16 ;
$this -> pos = $pos_16 ;
2012-04-16 07:37:57 +02:00
$_29 = NULL ;
2011-02-28 04:12:41 +01:00
do {
$res_18 = $result ;
$pos_18 = $this -> pos ;
2012-04-16 07:37:57 +02:00
$matcher = 'match_' . 'OpenBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_29 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
$result = $res_18 ;
$this -> pos = $pos_18 ;
2012-04-16 07:37:57 +02:00
$_27 = NULL ;
2012-04-11 11:34:27 +02:00
do {
$res_20 = $result ;
$pos_20 = $this -> pos ;
2012-04-16 07:37:57 +02:00
$matcher = 'match_' . 'MalformedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2012-04-11 11:34:27 +02:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_27 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
$result = $res_20 ;
$this -> pos = $pos_20 ;
2012-04-16 07:37:57 +02:00
$_25 = NULL ;
do {
$res_22 = $result ;
$pos_22 = $this -> pos ;
$matcher = 'match_' . 'Injection' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
$_25 = TRUE ; break ;
}
$result = $res_22 ;
$this -> pos = $pos_22 ;
$matcher = 'match_' . 'Text' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
$_25 = TRUE ; break ;
}
$result = $res_22 ;
$this -> pos = $pos_22 ;
$_25 = FALSE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 07:37:57 +02:00
while ( 0 );
if ( $_25 === TRUE ) { $_27 = TRUE ; break ; }
2012-04-11 11:34:27 +02:00
$result = $res_20 ;
$this -> pos = $pos_20 ;
2012-04-16 07:37:57 +02:00
$_27 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_27 === TRUE ) { $_29 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_18 ;
$this -> pos = $pos_18 ;
2012-04-16 07:37:57 +02:00
$_29 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_29 === TRUE ) { $_31 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_16 ;
$this -> pos = $pos_16 ;
2012-04-16 07:37:57 +02:00
$_31 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_31 === TRUE ) { $_33 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_14 ;
$this -> pos = $pos_14 ;
2012-04-16 07:37:57 +02:00
$_33 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_33 === TRUE ) { $_35 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_12 ;
$this -> pos = $pos_12 ;
2012-04-16 07:37:57 +02:00
$_35 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_35 === TRUE ) { $_37 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_10 ;
$this -> pos = $pos_10 ;
2012-04-16 07:37:57 +02:00
$_37 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_37 === TRUE ) { $_39 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_8 ;
$this -> pos = $pos_8 ;
2012-04-16 07:37:57 +02:00
$_39 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_39 === TRUE ) { $_41 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_6 ;
$this -> pos = $pos_6 ;
2012-04-16 07:37:57 +02:00
$_41 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_41 === TRUE ) { $_43 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_4 ;
$this -> pos = $pos_4 ;
2012-04-16 07:37:57 +02:00
$_43 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_43 === TRUE ) { $_45 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_2 ;
$this -> pos = $pos_2 ;
2012-04-16 07:37:57 +02:00
$_45 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_45 === TRUE ) { $_47 = TRUE ; break ; }
2011-02-28 04:12:41 +01:00
$result = $res_0 ;
$this -> pos = $pos_0 ;
2012-04-16 07:37:57 +02:00
$_47 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_47 === FALSE ) { $_49 = FALSE ; break ; }
$_49 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_49 === FALSE ) {
$result = $res_50 ;
$this -> pos = $pos_50 ;
unset ( $res_50 );
unset ( $pos_50 );
2011-02-28 04:12:41 +01:00
break ;
}
$count += 1 ;
}
if ( $count > 0 ) { return $this -> finalise ( $result ); }
else { return FALSE ; }
}
2012-09-19 12:07:39 +02:00
public function Template_STR ( & $res , $sub ) {
2011-02-28 04:12:41 +01:00
$res [ 'php' ] .= $sub [ 'php' ] . PHP_EOL ;
}
2011-02-09 05:31:16 +01:00
/* Word: / [A-Za-z_] [A-Za-z0-9_]* / */
2011-02-28 04:12:41 +01:00
protected $match_Word_typestack = array ( 'Word' );
2012-09-19 12:07:39 +02:00
public function match_Word ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " Word " ; $result = $this -> construct ( $matchrule , $matchrule , null );
if (( $subres = $this -> rx ( '/ [A-Za-z_] [A-Za-z0-9_]* /' ) ) !== FALSE ) {
2011-02-09 05:31:16 +01:00
$result [ " text " ] .= $subres ;
2011-02-28 04:12:41 +01:00
return $this -> finalise ( $result );
2011-02-09 05:31:16 +01:00
}
else { return FALSE ; }
}
/* Number: / [0-9]+ / */
2011-02-28 04:12:41 +01:00
protected $match_Number_typestack = array ( 'Number' );
2012-09-19 12:07:39 +02:00
public function match_Number ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " Number " ; $result = $this -> construct ( $matchrule , $matchrule , null );
if (( $subres = $this -> rx ( '/ [0-9]+ /' ) ) !== FALSE ) {
2011-02-09 05:31:16 +01:00
$result [ " text " ] .= $subres ;
2011-02-28 04:12:41 +01:00
return $this -> finalise ( $result );
2011-02-09 05:31:16 +01:00
}
else { return FALSE ; }
}
/* Value: / [A-Za-z0-9_]+ / */
2011-02-28 04:12:41 +01:00
protected $match_Value_typestack = array ( 'Value' );
2012-09-19 12:07:39 +02:00
public function match_Value ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " Value " ; $result = $this -> construct ( $matchrule , $matchrule , null );
if (( $subres = $this -> rx ( '/ [A-Za-z0-9_]+ /' ) ) !== FALSE ) {
2011-02-09 05:31:16 +01:00
$result [ " text " ] .= $subres ;
2011-02-28 04:12:41 +01:00
return $this -> finalise ( $result );
2011-02-09 05:31:16 +01:00
}
else { return FALSE ; }
}
2011-02-14 22:03:42 +01:00
/* CallArguments: :Argument ( < "," < :Argument )* */
2011-02-28 04:12:41 +01:00
protected $match_CallArguments_typestack = array ( 'CallArguments' );
2012-09-19 12:07:39 +02:00
public function match_CallArguments ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " CallArguments " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_61 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Argument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Argument " );
}
2012-04-16 07:37:57 +02:00
else { $_61 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_60 = $result ;
$pos_60 = $this -> pos ;
$_59 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == ',' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= ',' ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
else { $_59 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Argument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Argument " );
}
2012-04-16 07:37:57 +02:00
else { $_59 = FALSE ; break ; }
$_59 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_59 === FALSE ) {
$result = $res_60 ;
$this -> pos = $pos_60 ;
unset ( $res_60 );
unset ( $pos_60 );
2011-02-09 05:31:16 +01:00
break ;
}
}
2012-04-16 07:37:57 +02:00
$_61 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_61 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_61 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2011-02-14 22:03:42 +01:00
/**
* 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 .
*/
2012-09-19 12:07:39 +02:00
public 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' );
2012-09-19 12:07:39 +02:00
public function match_Call ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " Call " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_71 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Word' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Method " );
}
2012-04-16 07:37:57 +02:00
else { $_71 = FALSE ; break ; }
$res_70 = $result ;
$pos_70 = $this -> pos ;
$_69 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '(' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '(' ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
else { $_69 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
$res_66 = $result ;
$pos_66 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'CallArguments' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
2011-02-14 22:03:42 +01:00
$this -> store ( $result , $subres , " CallArguments " );
2011-02-09 05:31:16 +01:00
}
else {
2012-04-16 07:37:57 +02:00
$result = $res_66 ;
$this -> pos = $pos_66 ;
unset ( $res_66 );
unset ( $pos_66 );
2011-02-09 05:31:16 +01:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == ')' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= ')' ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
else { $_69 = FALSE ; break ; }
$_69 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_69 === FALSE ) {
$result = $res_70 ;
$this -> pos = $pos_70 ;
unset ( $res_70 );
unset ( $pos_70 );
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$_71 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_71 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_71 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
/* LookupStep: :Call &"." */
2011-02-28 04:12:41 +01:00
protected $match_LookupStep_typestack = array ( 'LookupStep' );
2012-09-19 12:07:39 +02:00
public function match_LookupStep ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " LookupStep " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_75 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Call' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Call " );
}
2012-04-16 07:37:57 +02:00
else { $_75 = FALSE ; break ; }
$res_74 = $result ;
$pos_74 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '.' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '.' ;
2012-04-16 07:37:57 +02:00
$result = $res_74 ;
$this -> pos = $pos_74 ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-16 07:37:57 +02:00
$result = $res_74 ;
$this -> pos = $pos_74 ;
$_75 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$_75 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_75 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_75 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
/* LastLookupStep: :Call */
2011-02-28 04:12:41 +01:00
protected $match_LastLookupStep_typestack = array ( 'LastLookupStep' );
2012-09-19 12:07:39 +02:00
public function match_LastLookupStep ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " LastLookupStep " ; $result = $this -> construct ( $matchrule , $matchrule , null );
$matcher = 'match_' . 'Call' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Call " );
2011-02-28 04:12:41 +01:00
return $this -> finalise ( $result );
2011-02-09 05:31:16 +01:00
}
else { return FALSE ; }
}
/* Lookup: LookupStep ("." LookupStep)* "." LastLookupStep | LastLookupStep */
2011-02-28 04:12:41 +01:00
protected $match_Lookup_typestack = array ( 'Lookup' );
2012-09-19 12:07:39 +02:00
public function match_Lookup ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " Lookup " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_89 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_78 = $result ;
$pos_78 = $this -> pos ;
$_86 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'LookupStep' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-16 07:37:57 +02:00
else { $_86 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_83 = $result ;
$pos_83 = $this -> pos ;
$_82 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '.' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '.' ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
else { $_82 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'LookupStep' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
}
2012-04-16 07:37:57 +02:00
else { $_82 = FALSE ; break ; }
$_82 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_82 === FALSE ) {
$result = $res_83 ;
$this -> pos = $pos_83 ;
unset ( $res_83 );
unset ( $pos_83 );
2011-02-09 05:31:16 +01:00
break ;
}
}
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '.' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '.' ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
else { $_86 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'LastLookupStep' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-16 07:37:57 +02:00
else { $_86 = FALSE ; break ; }
$_86 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_86 === TRUE ) { $_89 = TRUE ; break ; }
$result = $res_78 ;
$this -> pos = $pos_78 ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'LastLookupStep' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_89 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_78 ;
$this -> pos = $pos_78 ;
$_89 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_89 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_89 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public 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 .
*/
2012-09-19 12:07:39 +02:00
public function Lookup_AddLookupStep ( & $res , $sub , $method ) {
2011-02-09 05:31:16 +01:00
$res [ 'LookupSteps' ][] = $sub ;
$property = $sub [ 'Call' ][ 'Method' ][ 'text' ];
2011-02-14 22:03:42 +01:00
if ( isset ( $sub [ 'Call' ][ 'CallArguments' ]) && $arguments = $sub [ 'Call' ][ 'CallArguments' ][ 'php' ]) {
2011-02-09 05:31:16 +01:00
$res [ 'php' ] .= " -> $method (' $property ', array( $arguments ), true) " ;
}
else {
$res [ 'php' ] .= " -> $method (' $property ', null, true) " ;
}
}
2012-09-19 12:07:39 +02:00
public function Lookup_LookupStep ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
$this -> Lookup_AddLookupStep ( $res , $sub , 'obj' );
}
2012-09-19 12:07:39 +02:00
public 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' );
2012-09-19 12:07:39 +02:00
public function match_Translate ( $stack = array ()) {
2012-04-16 06:59:56 +02:00
$matchrule = " Translate " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_115 = NULL ;
2012-04-16 06:59:56 +02:00
do {
if (( $subres = $this -> literal ( '<%t' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_115 = FALSE ; break ; }
2012-04-16 06:59:56 +02:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$matcher = 'match_' . 'Entity' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-16 07:37:57 +02:00
else { $_115 = FALSE ; break ; }
2012-04-16 06:59:56 +02:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
$res_97 = $result ;
$pos_97 = $this -> pos ;
$_96 = NULL ;
2012-04-16 06:59:56 +02:00
do {
$matcher = 'match_' . 'QuotedString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Default " );
}
2012-04-16 07:37:57 +02:00
else { $_96 = FALSE ; break ; }
$_96 = TRUE ; break ;
2012-04-16 06:59:56 +02:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_96 === FALSE ) {
$result = $res_97 ;
$this -> pos = $pos_97 ;
unset ( $res_97 );
unset ( $pos_97 );
2012-04-16 06:59:56 +02:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
$res_108 = $result ;
$pos_108 = $this -> pos ;
$_107 = NULL ;
2012-04-16 06:59:56 +02:00
do {
2012-04-16 07:37:57 +02:00
$res_102 = $result ;
$pos_102 = $this -> pos ;
$_101 = NULL ;
2012-04-16 06:59:56 +02:00
do {
if (( $subres = $this -> literal ( 'is' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_101 = FALSE ; break ; }
2012-04-16 06:59:56 +02:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '=' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '=' ;
}
2012-04-16 07:37:57 +02:00
else { $_101 = FALSE ; break ; }
$_101 = TRUE ; break ;
2012-04-16 06:59:56 +02:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_101 === TRUE ) {
$result = $res_102 ;
$this -> pos = $pos_102 ;
$_107 = FALSE ; break ;
2012-04-16 06:59:56 +02:00
}
2012-04-16 07:37:57 +02:00
if ( $_101 === FALSE ) {
$result = $res_102 ;
$this -> pos = $pos_102 ;
2012-04-16 06:59:56 +02:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
if (( $subres = $this -> literal ( 'is' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_107 = FALSE ; break ; }
2012-04-16 06:59:56 +02:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$matcher = 'match_' . 'QuotedString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Context " );
}
2012-04-16 07:37:57 +02:00
else { $_107 = FALSE ; break ; }
$_107 = TRUE ; break ;
2012-04-16 06:59:56 +02:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_107 === FALSE ) {
$result = $res_108 ;
$this -> pos = $pos_108 ;
unset ( $res_108 );
unset ( $pos_108 );
2012-04-16 06:59:56 +02:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
$res_112 = $result ;
$pos_112 = $this -> pos ;
$_111 = NULL ;
2012-04-16 06:59:56 +02:00
do {
$matcher = 'match_' . 'InjectionVariables' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-16 07:37:57 +02:00
else { $_111 = FALSE ; break ; }
$_111 = TRUE ; break ;
2012-04-16 06:59:56 +02:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_111 === FALSE ) {
$result = $res_112 ;
$this -> pos = $pos_112 ;
unset ( $res_112 );
unset ( $pos_112 );
2012-04-16 06:59:56 +02:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
if (( $subres = $this -> literal ( '%>' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_115 = FALSE ; break ; }
$_115 = TRUE ; break ;
2012-04-16 06:59:56 +02:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_115 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_115 === FALSE ) { return FALSE ; }
2012-04-16 06:59:56 +02:00
}
/* InjectionVariables: (< InjectionName:Word "=" Argument)+ */
protected $match_InjectionVariables_typestack = array ( 'InjectionVariables' );
2012-09-19 12:07:39 +02:00
public function match_InjectionVariables ( $stack = array ()) {
2012-04-16 06:59:56 +02:00
$matchrule = " InjectionVariables " ; $result = $this -> construct ( $matchrule , $matchrule , null );
$count = 0 ;
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_122 = $result ;
$pos_122 = $this -> pos ;
$_121 = NULL ;
2012-04-16 06:59:56 +02:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
$matcher = 'match_' . 'Word' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " InjectionName " );
}
2012-04-16 07:37:57 +02:00
else { $_121 = FALSE ; break ; }
2012-04-16 06:59:56 +02:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '=' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '=' ;
}
2012-04-16 07:37:57 +02:00
else { $_121 = FALSE ; break ; }
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'Argument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-16 07:37:57 +02:00
else { $_121 = FALSE ; break ; }
$_121 = TRUE ; break ;
2012-04-16 06:59:56 +02:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_121 === FALSE ) {
$result = $res_122 ;
$this -> pos = $pos_122 ;
unset ( $res_122 );
unset ( $pos_122 );
2012-04-16 06:59:56 +02:00
break ;
}
$count += 1 ;
}
if ( $count > 0 ) { return $this -> finalise ( $result ); }
else { return FALSE ; }
}
/* Entity: / [A-Za-z_] [\w\.]* / */
protected $match_Entity_typestack = array ( 'Entity' );
2012-09-19 12:07:39 +02:00
public function match_Entity ( $stack = array ()) {
2012-04-16 06:59:56 +02:00
$matchrule = " Entity " ; $result = $this -> construct ( $matchrule , $matchrule , null );
if (( $subres = $this -> rx ( '/ [A-Za-z_] [\w\.]* /' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
return $this -> finalise ( $result );
}
else { return FALSE ; }
}
2012-09-19 12:07:39 +02:00
public function Translate__construct ( & $res ) {
2012-04-16 06:59:56 +02:00
$res [ 'php' ] = '$val .= _t(' ;
}
2012-09-19 12:07:39 +02:00
public function Translate_Entity ( & $res , $sub ) {
2012-04-16 06:59:56 +02:00
$res [ 'php' ] .= " ' $sub[text] ' " ;
}
2012-09-19 12:07:39 +02:00
public function Translate_Default ( & $res , $sub ) {
2012-04-16 06:59:56 +02:00
$res [ 'php' ] .= " , $sub[text] " ;
}
2012-09-19 12:07:39 +02:00
public function Translate_Context ( & $res , $sub ) {
2012-04-16 06:59:56 +02:00
$res [ 'php' ] .= " , $sub[text] " ;
}
2012-09-19 12:07:39 +02:00
public function Translate_InjectionVariables ( & $res , $sub ) {
2012-04-16 06:59:56 +02:00
$res [ 'php' ] .= " , $sub[php] " ;
}
2012-09-19 12:07:39 +02:00
public function Translate__finalise ( & $res ) {
2012-04-16 06:59:56 +02:00
$res [ 'php' ] .= ');' ;
}
2012-09-19 12:07:39 +02:00
public function InjectionVariables__construct ( & $res ) {
2012-04-16 06:59:56 +02:00
$res [ 'php' ] = " array( " ;
}
2012-09-19 12:07:39 +02:00
public function InjectionVariables_InjectionName ( & $res , $sub ) {
2012-04-16 06:59:56 +02:00
$res [ 'php' ] .= " ' $sub[text] '=> " ;
}
2012-09-19 12:07:39 +02:00
public function InjectionVariables_Argument ( & $res , $sub ) {
2012-04-16 06:59:56 +02:00
$res [ 'php' ] .= str_replace ( '$$FINAL' , 'XML_val' , $sub [ 'php' ]) . ',' ;
}
2012-09-19 12:07:39 +02:00
public function InjectionVariables__finalise ( & $res ) {
2012-04-16 06:59:56 +02:00
if ( substr ( $res [ 'php' ], - 1 ) == ',' ) $res [ 'php' ] = substr ( $res [ 'php' ], 0 , - 1 ); //remove last comma in the array
$res [ 'php' ] .= ')' ;
}
2011-02-09 05:31:16 +01:00
/* SimpleInjection: '$' :Lookup */
2011-02-28 04:12:41 +01:00
protected $match_SimpleInjection_typestack = array ( 'SimpleInjection' );
2012-09-19 12:07:39 +02:00
public function match_SimpleInjection ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " SimpleInjection " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_126 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if ( substr ( $this -> string , $this -> pos , 1 ) == '$' ) {
$this -> pos += 1 ;
$result [ " text " ] .= '$' ;
}
2012-04-16 07:37:57 +02:00
else { $_126 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Lookup' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Lookup " );
}
2012-04-16 07:37:57 +02:00
else { $_126 = FALSE ; break ; }
$_126 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_126 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_126 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
/* BracketInjection: '{$' :Lookup "}" */
2011-02-28 04:12:41 +01:00
protected $match_BracketInjection_typestack = array ( 'BracketInjection' );
2012-09-19 12:07:39 +02:00
public function match_BracketInjection ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " BracketInjection " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_131 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '{$' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_131 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Lookup' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Lookup " );
}
2012-04-16 07:37:57 +02:00
else { $_131 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '}' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '}' ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
else { $_131 = FALSE ; break ; }
$_131 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_131 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_131 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
/* Injection: BracketInjection | SimpleInjection */
2011-02-28 04:12:41 +01:00
protected $match_Injection_typestack = array ( 'Injection' );
2012-09-19 12:07:39 +02:00
public function match_Injection ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " Injection " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_136 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_133 = $result ;
$pos_133 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'BracketInjection' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_136 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_133 ;
$this -> pos = $pos_133 ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'SimpleInjection' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_136 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_133 ;
$this -> pos = $pos_133 ;
$_136 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_136 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_136 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function Injection_STR ( & $res , $sub ) {
2011-02-18 05:06:11 +01:00
$res [ 'php' ] = '$val .= ' . str_replace ( '$$FINAL' , 'XML_val' , $sub [ 'Lookup' ][ 'php' ]) . ';' ;
2011-02-09 05:31:16 +01:00
}
2011-02-14 22:03:42 +01:00
/* DollarMarkedLookup: SimpleInjection */
2011-02-28 04:12:41 +01:00
protected $match_DollarMarkedLookup_typestack = array ( 'DollarMarkedLookup' );
2012-09-19 12:07:39 +02:00
public function match_DollarMarkedLookup ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " DollarMarkedLookup " ; $result = $this -> construct ( $matchrule , $matchrule , null );
$matcher = 'match_' . 'SimpleInjection' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-14 22:03:42 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2011-02-28 04:12:41 +01:00
return $this -> finalise ( $result );
2011-02-09 05:31:16 +01:00
}
2011-02-14 22:03:42 +01:00
else { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function DollarMarkedLookup_STR ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
$res [ 'Lookup' ] = $sub [ 'Lookup' ];
}
/* QuotedString: q:/['"]/ String:/ (\\\\ | \\. | [^$q\\])* / '$q' */
2011-02-28 04:12:41 +01:00
protected $match_QuotedString_typestack = array ( 'QuotedString' );
2012-09-19 12:07:39 +02:00
public function match_QuotedString ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " QuotedString " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_142 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$stack [] = $result ; $result = $this -> construct ( $matchrule , " q " );
if (( $subres = $this -> rx ( '/[\'"]/' ) ) !== FALSE ) {
2011-02-09 05:31:16 +01:00
$result [ " text " ] .= $subres ;
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
2011-02-09 05:31:16 +01:00
$this -> store ( $result , $subres , 'q' );
}
else {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 07:37:57 +02:00
$_142 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
$stack [] = $result ; $result = $this -> construct ( $matchrule , " String " );
if (( $subres = $this -> rx ( '/ (\\\\\\\\ | \\\\. | [^' . $this -> expression ( $result , $stack , 'q' ) . '\\\\])* /' ) ) !== FALSE ) {
2011-02-09 05:31:16 +01:00
$result [ " text " ] .= $subres ;
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
2011-02-09 05:31:16 +01:00
$this -> store ( $result , $subres , 'String' );
}
else {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 07:37:57 +02:00
$_142 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '' . $this -> expression ( $result , $stack , 'q' ) . '' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_142 = FALSE ; break ; }
$_142 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_142 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_142 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
/* FreeString: /[^,)%!=|&]+/ */
2011-02-28 04:12:41 +01:00
protected $match_FreeString_typestack = array ( 'FreeString' );
2012-09-19 12:07:39 +02:00
public function match_FreeString ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$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' );
2012-09-19 12:07:39 +02:00
public function match_Argument ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " Argument " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_162 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_145 = $result ;
$pos_145 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'DollarMarkedLookup' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " DollarMarkedLookup " );
2012-04-16 07:37:57 +02:00
$_162 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_145 ;
$this -> pos = $pos_145 ;
$_160 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_147 = $result ;
$pos_147 = $this -> pos ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'QuotedString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " QuotedString " );
2012-04-16 07:37:57 +02:00
$_160 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_147 ;
$this -> pos = $pos_147 ;
$_158 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_149 = $result ;
$pos_149 = $this -> pos ;
$_155 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Lookup' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Lookup " );
}
2012-04-16 07:37:57 +02:00
else { $_155 = FALSE ; break ; }
$res_154 = $result ;
$pos_154 = $this -> pos ;
$_153 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'FreeString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
}
2012-04-16 07:37:57 +02:00
else { $_153 = FALSE ; break ; }
$_153 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_153 === TRUE ) {
$result = $res_154 ;
$this -> pos = $pos_154 ;
$_155 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
if ( $_153 === FALSE ) {
$result = $res_154 ;
$this -> pos = $pos_154 ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$_155 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_155 === TRUE ) { $_158 = TRUE ; break ; }
$result = $res_149 ;
$this -> pos = $pos_149 ;
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'FreeString' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " FreeString " );
2012-04-16 07:37:57 +02:00
$_158 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_149 ;
$this -> pos = $pos_149 ;
$_158 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_158 === TRUE ) { $_160 = TRUE ; break ; }
$result = $res_147 ;
$this -> pos = $pos_147 ;
$_160 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_160 === TRUE ) { $_162 = TRUE ; break ; }
$result = $res_145 ;
$this -> pos = $pos_145 ;
$_162 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_162 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_162 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2011-02-14 22:03:42 +01:00
/**
* If we get a bare value , we don ' t know enough to determine exactly what php would be the translation , because
* we don ' t know if the position of use indicates a lookup or a string argument .
*
* Instead , we record 'ArgumentMode' as a member of this matches results node , which can be :
* - lookup if this argument was unambiguously a lookup ( marked as such )
* - string is this argument was unambiguously a string ( marked as such , or impossible to parse as lookup )
* - default if this argument needs to be handled as per 2.4
*
* In the case of 'default' , there is no php member of the results node , but instead 'lookup_php' , which
* should be used by the parent if the context indicates a lookup , and 'string_php' which should be used
* if the context indicates a string
*/
2012-09-19 12:07:39 +02:00
public function Argument_DollarMarkedLookup ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
$res [ 'ArgumentMode' ] = 'lookup' ;
$res [ 'php' ] = $sub [ 'Lookup' ][ 'php' ];
}
2012-09-19 12:07:39 +02:00
public function Argument_QuotedString ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
$res [ 'ArgumentMode' ] = 'string' ;
2011-02-21 05:44:46 +01:00
$res [ 'php' ] = " ' " . str_replace ( " ' " , " \\ ' " , $sub [ 'String' ][ 'text' ]) . " ' " ;
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function Argument_Lookup ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
if ( count ( $sub [ 'LookupSteps' ]) == 1 && ! isset ( $sub [ 'LookupSteps' ][ 0 ][ 'Call' ][ 'Arguments' ])) {
$res [ 'ArgumentMode' ] = 'default' ;
$res [ 'lookup_php' ] = $sub [ 'php' ];
$res [ 'string_php' ] = " ' " . $sub [ 'LookupSteps' ][ 0 ][ 'Call' ][ 'Method' ][ 'text' ] . " ' " ;
}
else {
$res [ 'ArgumentMode' ] = 'lookup' ;
$res [ 'php' ] = $sub [ 'php' ];
}
}
2012-09-19 12:07:39 +02:00
public function Argument_FreeString ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
$res [ 'ArgumentMode' ] = 'string' ;
2012-07-23 01:56:44 +02:00
$res [ 'php' ] = " ' " . str_replace ( " ' " , " \\ ' " , trim ( $sub [ 'text' ])) . " ' " ;
2011-02-09 05:31:16 +01:00
}
/* ComparisonOperator: "==" | "!=" | "=" */
2011-02-28 04:12:41 +01:00
protected $match_ComparisonOperator_typestack = array ( 'ComparisonOperator' );
2012-09-19 12:07:39 +02:00
public function match_ComparisonOperator ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " ComparisonOperator " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_171 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_164 = $result ;
$pos_164 = $this -> pos ;
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 07:37:57 +02:00
$_171 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_164 ;
$this -> pos = $pos_164 ;
$_169 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_166 = $result ;
$pos_166 = $this -> pos ;
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 07:37:57 +02:00
$_169 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_166 ;
$this -> pos = $pos_166 ;
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == '=' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= '=' ;
2012-04-16 07:37:57 +02:00
$_169 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_166 ;
$this -> pos = $pos_166 ;
$_169 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_169 === TRUE ) { $_171 = TRUE ; break ; }
$result = $res_164 ;
$this -> pos = $pos_164 ;
$_171 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_171 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_171 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
/* Comparison: Argument < ComparisonOperator > Argument */
2011-02-28 04:12:41 +01:00
protected $match_Comparison_typestack = array ( 'Comparison' );
2012-09-19 12:07:39 +02:00
public function match_Comparison ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " Comparison " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_178 = 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 07:37:57 +02:00
else { $_178 = 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 07:37:57 +02:00
else { $_178 = 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 07:37:57 +02:00
else { $_178 = FALSE ; break ; }
$_178 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_178 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_178 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function Comparison_Argument ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
if ( $sub [ 'ArgumentMode' ] == 'default' ) {
2011-02-28 04:12:41 +01:00
if ( ! empty ( $res [ 'php' ])) $res [ 'php' ] .= $sub [ 'string_php' ];
2011-02-18 05:06:11 +01:00
else $res [ 'php' ] = str_replace ( '$$FINAL' , 'XML_val' , $sub [ 'lookup_php' ]);
2011-02-09 05:31:16 +01:00
}
else {
2011-02-18 05:06:11 +01:00
$res [ 'php' ] .= str_replace ( '$$FINAL' , 'XML_val' , $sub [ 'php' ]);
2011-02-09 05:31:16 +01:00
}
}
2012-09-19 12:07:39 +02:00
public function Comparison_ComparisonOperator ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
$res [ 'php' ] .= ( $sub [ 'text' ] == '=' ? '==' : $sub [ 'text' ]);
}
2011-02-21 03:24:14 +01:00
/* PresenceCheck: (Not:'not' <)? Argument */
2011-02-28 04:12:41 +01:00
protected $match_PresenceCheck_typestack = array ( 'PresenceCheck' );
2012-09-19 12:07:39 +02:00
public function match_PresenceCheck ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " PresenceCheck " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_185 = NULL ;
2011-02-21 03:24:14 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_183 = $result ;
$pos_183 = $this -> pos ;
$_182 = 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 07:37:57 +02:00
$_182 = FALSE ; break ;
2011-02-21 03:24:14 +01:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
$_182 = TRUE ; break ;
2011-02-21 03:24:14 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_182 === FALSE ) {
$result = $res_183 ;
$this -> pos = $pos_183 ;
unset ( $res_183 );
unset ( $pos_183 );
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 07:37:57 +02:00
else { $_185 = FALSE ; break ; }
$_185 = TRUE ; break ;
2011-02-21 03:24:14 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_185 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_185 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function PresenceCheck_Not ( & $res , $sub ) {
2011-02-21 03:24:14 +01:00
$res [ 'php' ] = '!' ;
}
2012-09-19 12:07:39 +02:00
public function PresenceCheck_Argument ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
if ( $sub [ 'ArgumentMode' ] == 'string' ) {
2011-02-21 03:24:14 +01:00
$res [ 'php' ] .= '((bool)' . $sub [ 'php' ] . ')' ;
2011-02-09 05:31:16 +01:00
}
else {
$php = ( $sub [ 'ArgumentMode' ] == 'default' ? $sub [ 'lookup_php' ] : $sub [ 'php' ]);
// TODO: kinda hacky - maybe we need a way to pass state down the parse chain so
// Lookup_LastLookupStep and Argument_BareWord can produce hasValue instead of XML_val
2011-02-21 03:24:14 +01:00
$res [ 'php' ] .= str_replace ( '$$FINAL' , 'hasValue' , $php );
2011-02-09 05:31:16 +01:00
}
}
/* IfArgumentPortion: Comparison | PresenceCheck */
2011-02-28 04:12:41 +01:00
protected $match_IfArgumentPortion_typestack = array ( 'IfArgumentPortion' );
2012-09-19 12:07:39 +02:00
public function match_IfArgumentPortion ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " IfArgumentPortion " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_190 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_187 = $result ;
$pos_187 = $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 07:37:57 +02:00
$_190 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_187 ;
$this -> pos = $pos_187 ;
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 07:37:57 +02:00
$_190 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_187 ;
$this -> pos = $pos_187 ;
$_190 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_190 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_190 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function IfArgumentPortion_STR ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
$res [ 'php' ] = $sub [ 'php' ];
}
/* BooleanOperator: "||" | "&&" */
2011-02-28 04:12:41 +01:00
protected $match_BooleanOperator_typestack = array ( 'BooleanOperator' );
2012-09-19 12:07:39 +02:00
public function match_BooleanOperator ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " BooleanOperator " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_195 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_192 = $result ;
$pos_192 = $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 07:37:57 +02:00
$_195 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_192 ;
$this -> pos = $pos_192 ;
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 07:37:57 +02:00
$_195 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_192 ;
$this -> pos = $pos_192 ;
$_195 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_195 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_195 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
/* IfArgument: :IfArgumentPortion ( < :BooleanOperator < :IfArgumentPortion )* */
2011-02-28 04:12:41 +01:00
protected $match_IfArgument_typestack = array ( 'IfArgument' );
2012-09-19 12:07:39 +02:00
public function match_IfArgument ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " IfArgument " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_204 = 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 07:37:57 +02:00
else { $_204 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_203 = $result ;
$pos_203 = $this -> pos ;
$_202 = 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 07:37:57 +02:00
else { $_202 = 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 07:37:57 +02:00
else { $_202 = FALSE ; break ; }
$_202 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_202 === FALSE ) {
$result = $res_203 ;
$this -> pos = $pos_203 ;
unset ( $res_203 );
unset ( $pos_203 );
2011-02-09 05:31:16 +01:00
break ;
}
}
2012-04-16 07:37:57 +02:00
$_204 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_204 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_204 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function IfArgument_IfArgumentPortion ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
$res [ 'php' ] .= $sub [ 'php' ];
}
2012-09-19 12:07:39 +02:00
public function IfArgument_BooleanOperator ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
$res [ 'php' ] .= $sub [ 'text' ];
}
2011-02-28 04:12:41 +01:00
/* IfPart: '<%' < 'if' [ :IfArgument > '%>' Template:$TemplateMatcher? */
protected $match_IfPart_typestack = array ( 'IfPart' );
2012-09-19 12:07:39 +02:00
public function match_IfPart ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " IfPart " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_214 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_214 = 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 07:37:57 +02:00
else { $_214 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_214 = 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 07:37:57 +02:00
else { $_214 = 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 07:37:57 +02:00
else { $_214 = FALSE ; break ; }
$res_213 = $result ;
$pos_213 = $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 07:37:57 +02:00
$result = $res_213 ;
$this -> pos = $pos_213 ;
unset ( $res_213 );
unset ( $pos_213 );
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$_214 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_214 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_214 === 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' );
2012-09-19 12:07:39 +02:00
public function match_ElseIfPart ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " ElseIfPart " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_224 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_224 = 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 07:37:57 +02:00
else { $_224 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_224 = 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 07:37:57 +02:00
else { $_224 = 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 07:37:57 +02:00
else { $_224 = 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 07:37:57 +02:00
else { $_224 = FALSE ; break ; }
$_224 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_224 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_224 === 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' );
2012-09-19 12:07:39 +02:00
public function match_ElsePart ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " ElsePart " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_232 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_232 = 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 07:37:57 +02:00
else { $_232 = 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 07:37:57 +02:00
else { $_232 = 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 07:37:57 +02:00
else { $_232 = FALSE ; break ; }
$_232 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_232 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_232 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
/* If: IfPart ElseIfPart* ElsePart? '<%' < 'end_if' > '%>' */
2011-02-28 04:12:41 +01:00
protected $match_If_typestack = array ( 'If' );
2012-09-19 12:07:39 +02:00
public function match_If ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " If " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_242 = 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 07:37:57 +02:00
else { $_242 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_235 = $result ;
$pos_235 = $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 07:37:57 +02:00
$result = $res_235 ;
$this -> pos = $pos_235 ;
unset ( $res_235 );
unset ( $pos_235 );
2011-02-09 05:31:16 +01:00
break ;
}
}
2012-04-16 07:37:57 +02:00
$res_236 = $result ;
$pos_236 = $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 07:37:57 +02:00
$result = $res_236 ;
$this -> pos = $pos_236 ;
unset ( $res_236 );
unset ( $pos_236 );
2011-02-28 04:12:41 +01:00
}
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_242 = 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 07:37:57 +02:00
else { $_242 = 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 07:37:57 +02:00
else { $_242 = FALSE ; break ; }
$_242 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_242 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_242 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function If_IfPart ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
$res [ 'php' ] =
'if (' . $sub [ 'IfArgument' ][ 'php' ] . ') { ' . PHP_EOL .
2011-02-21 04:19:10 +01:00
( isset ( $sub [ 'Template' ]) ? $sub [ 'Template' ][ 'php' ] : '' ) . PHP_EOL .
2011-02-09 05:31:16 +01:00
'}' ;
}
2012-09-19 12:07:39 +02:00
public function If_ElseIfPart ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
$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
'}' ;
}
2012-09-19 12:07:39 +02:00
public function If_ElsePart ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
$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' );
2012-09-19 12:07:39 +02:00
public function match_Require ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " Require " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_258 = NULL ;
2011-02-28 04:12:41 +01:00
do {
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_258 = 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 07:37:57 +02:00
else { $_258 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_258 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
$stack [] = $result ; $result = $this -> construct ( $matchrule , " Call " );
2012-04-16 07:37:57 +02:00
$_254 = 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 07:37:57 +02:00
else { $_254 = 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 07:37:57 +02:00
else { $_254 = 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 07:37:57 +02:00
else { $_254 = 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 07:37:57 +02:00
else { $_254 = FALSE ; break ; }
$_254 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_254 === TRUE ) {
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
$this -> store ( $result , $subres , 'Call' );
}
2012-04-16 07:37:57 +02:00
if ( $_254 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 07:37:57 +02:00
$_258 = 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 07:37:57 +02:00
else { $_258 = FALSE ; break ; }
$_258 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_258 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_258 === FALSE ) { return FALSE ; }
2011-02-28 04:12:41 +01:00
}
2012-09-19 12:07:39 +02:00
public function Require_Call ( & $res , $sub ) {
2011-02-28 04:12:41 +01:00
$res [ 'php' ] = " Requirements:: " . $sub [ 'Method' ][ 'text' ] . '(' . $sub [ 'CallArguments' ][ 'php' ] . ');' ;
}
/* CacheBlockArgument :
! ( " if " | " unless " )
(
: DollarMarkedLookup |
: QuotedString |
: Lookup
) */
protected $match_CacheBlockArgument_typestack = array ( 'CacheBlockArgument' );
2012-09-19 12:07:39 +02:00
public function match_CacheBlockArgument ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " CacheBlockArgument " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_278 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_266 = $result ;
$pos_266 = $this -> pos ;
$_265 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$_263 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_260 = $result ;
$pos_260 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'if ' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_263 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_260 ;
$this -> pos = $pos_260 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'unless ' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_263 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_260 ;
$this -> pos = $pos_260 ;
$_263 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_263 === FALSE ) { $_265 = FALSE ; break ; }
$_265 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_265 === TRUE ) {
$result = $res_266 ;
$this -> pos = $pos_266 ;
$_278 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
if ( $_265 === FALSE ) {
$result = $res_266 ;
$this -> pos = $pos_266 ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$_276 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$_274 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_267 = $result ;
$pos_267 = $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 07:37:57 +02:00
$_274 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_267 ;
$this -> pos = $pos_267 ;
$_272 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_269 = $result ;
$pos_269 = $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 07:37:57 +02:00
$_272 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_269 ;
$this -> pos = $pos_269 ;
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 07:37:57 +02:00
$_272 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_269 ;
$this -> pos = $pos_269 ;
$_272 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_272 === TRUE ) { $_274 = TRUE ; break ; }
$result = $res_267 ;
$this -> pos = $pos_267 ;
$_274 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_274 === FALSE ) { $_276 = FALSE ; break ; }
$_276 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_276 === FALSE ) { $_278 = FALSE ; break ; }
$_278 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_278 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_278 === FALSE ) { return FALSE ; }
2011-02-28 04:12:41 +01:00
}
2012-09-19 12:07:39 +02:00
public function CacheBlockArgument_DollarMarkedLookup ( & $res , $sub ) {
2011-02-28 04:12:41 +01:00
$res [ 'php' ] = $sub [ 'Lookup' ][ 'php' ];
}
2012-09-19 12:07:39 +02:00
public function CacheBlockArgument_QuotedString ( & $res , $sub ) {
2011-02-28 04:12:41 +01:00
$res [ 'php' ] = " ' " . str_replace ( " ' " , " \\ ' " , $sub [ 'String' ][ 'text' ]) . " ' " ;
}
2012-09-19 12:07:39 +02:00
public function CacheBlockArgument_Lookup ( & $res , $sub ) {
2011-02-28 04:12:41 +01:00
$res [ 'php' ] = $sub [ 'php' ];
}
/* CacheBlockArguments: CacheBlockArgument ( < "," < CacheBlockArgument )* */
protected $match_CacheBlockArguments_typestack = array ( 'CacheBlockArguments' );
2012-09-19 12:07:39 +02:00
public function match_CacheBlockArguments ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " CacheBlockArguments " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_287 = 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 07:37:57 +02:00
else { $_287 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_286 = $result ;
$pos_286 = $this -> pos ;
$_285 = 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 07:37:57 +02:00
else { $_285 = 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 07:37:57 +02:00
else { $_285 = FALSE ; break ; }
$_285 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_285 === FALSE ) {
$result = $res_286 ;
$this -> pos = $pos_286 ;
unset ( $res_286 );
unset ( $pos_286 );
2011-02-28 04:12:41 +01:00
break ;
}
}
2012-04-16 07:37:57 +02:00
$_287 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_287 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_287 === FALSE ) { return FALSE ; }
2011-02-28 04:12:41 +01:00
}
2012-09-19 12:07:39 +02:00
public function CacheBlockArguments_CacheBlockArgument ( & $res , $sub ) {
2011-02-28 04:12:41 +01:00
if ( ! empty ( $res [ 'php' ])) $res [ 'php' ] .= " .'_'. " ;
else $res [ 'php' ] = '' ;
$res [ 'php' ] .= str_replace ( '$$FINAL' , 'XML_val' , $sub [ 'php' ]);
}
2012-04-16 07:37:57 +02:00
/* CacheBlockTemplate: (Comment | Translate | If | Require | OldI18NTag | Include | ClosedBlock | OpenBlock | MalformedBlock | Injection | Text)+ */
2011-02-28 04:12:41 +01:00
protected $match_CacheBlockTemplate_typestack = array ( 'CacheBlockTemplate' , 'Template' );
2012-09-19 12:07:39 +02:00
public function match_CacheBlockTemplate ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " CacheBlockTemplate " ; $result = $this -> construct ( $matchrule , $matchrule , array ( 'TemplateMatcher' => 'CacheRestrictedTemplate' ));
$count = 0 ;
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_331 = $result ;
$pos_331 = $this -> pos ;
$_330 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$_328 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_289 = $result ;
$pos_289 = $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 07:37:57 +02:00
$_328 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_289 ;
$this -> pos = $pos_289 ;
$_326 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_291 = $result ;
$pos_291 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'Translate' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_326 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_291 ;
$this -> pos = $pos_291 ;
$_324 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_293 = $result ;
$pos_293 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'If' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_324 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_293 ;
$this -> pos = $pos_293 ;
$_322 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_295 = $result ;
$pos_295 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'Require' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_322 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_295 ;
$this -> pos = $pos_295 ;
$_320 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_297 = $result ;
$pos_297 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'OldI18NTag' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_320 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_297 ;
$this -> pos = $pos_297 ;
$_318 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_299 = $result ;
$pos_299 = $this -> pos ;
$matcher = 'match_' . 'Include' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_318 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_299 ;
$this -> pos = $pos_299 ;
$_316 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_301 = $result ;
$pos_301 = $this -> pos ;
$matcher = 'match_' . 'ClosedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_316 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_301 ;
$this -> pos = $pos_301 ;
$_314 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_303 = $result ;
$pos_303 = $this -> pos ;
$matcher = 'match_' . 'OpenBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_314 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_303 ;
$this -> pos = $pos_303 ;
$_312 = NULL ;
2012-04-11 11:34:27 +02:00
do {
2012-04-16 07:37:57 +02:00
$res_305 = $result ;
$pos_305 = $this -> pos ;
$matcher = 'match_' . 'MalformedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2012-04-11 11:34:27 +02:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_312 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 07:37:57 +02:00
$result = $res_305 ;
$this -> pos = $pos_305 ;
$_310 = NULL ;
do {
$res_307 = $result ;
$pos_307 = $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 );
$_310 = TRUE ; break ;
}
$result = $res_307 ;
$this -> pos = $pos_307 ;
$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 );
$_310 = TRUE ; break ;
}
$result = $res_307 ;
$this -> pos = $pos_307 ;
$_310 = FALSE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 07:37:57 +02:00
while ( 0 );
if ( $_310 === TRUE ) { $_312 = TRUE ; break ; }
$result = $res_305 ;
$this -> pos = $pos_305 ;
$_312 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_312 === TRUE ) { $_314 = TRUE ; break ; }
$result = $res_303 ;
$this -> pos = $pos_303 ;
$_314 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_314 === TRUE ) { $_316 = TRUE ; break ; }
$result = $res_301 ;
$this -> pos = $pos_301 ;
$_316 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_316 === TRUE ) { $_318 = TRUE ; break ; }
$result = $res_299 ;
$this -> pos = $pos_299 ;
$_318 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_318 === TRUE ) { $_320 = TRUE ; break ; }
$result = $res_297 ;
$this -> pos = $pos_297 ;
$_320 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_320 === TRUE ) { $_322 = TRUE ; break ; }
$result = $res_295 ;
$this -> pos = $pos_295 ;
$_322 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_322 === TRUE ) { $_324 = TRUE ; break ; }
$result = $res_293 ;
$this -> pos = $pos_293 ;
$_324 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_324 === TRUE ) { $_326 = TRUE ; break ; }
$result = $res_291 ;
$this -> pos = $pos_291 ;
$_326 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_326 === TRUE ) { $_328 = TRUE ; break ; }
$result = $res_289 ;
$this -> pos = $pos_289 ;
$_328 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_328 === FALSE ) { $_330 = FALSE ; break ; }
$_330 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_330 === FALSE ) {
$result = $res_331 ;
$this -> pos = $pos_331 ;
unset ( $res_331 );
unset ( $pos_331 );
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' );
2012-09-19 12:07:39 +02:00
public function match_UncachedBlock ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " UncachedBlock " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_368 = NULL ;
2011-02-28 04:12:41 +01:00
do {
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_368 = 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 07:37:57 +02:00
else { $_368 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
$res_336 = $result ;
$pos_336 = $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 07:37:57 +02:00
$result = $res_336 ;
$this -> pos = $pos_336 ;
unset ( $res_336 );
unset ( $pos_336 );
}
$res_348 = $result ;
$pos_348 = $this -> pos ;
$_347 = 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 07:37:57 +02:00
$_343 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$_341 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_338 = $result ;
$pos_338 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'if' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_341 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_338 ;
$this -> pos = $pos_338 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'unless' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_341 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_338 ;
$this -> pos = $pos_338 ;
$_341 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_341 === FALSE ) { $_343 = FALSE ; break ; }
$_343 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_343 === TRUE ) {
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
$this -> store ( $result , $subres , 'Conditional' );
}
2012-04-16 07:37:57 +02:00
if ( $_343 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 07:37:57 +02:00
$_347 = 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 07:37:57 +02:00
else { $_347 = FALSE ; break ; }
$_347 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_347 === FALSE ) {
$result = $res_348 ;
$this -> pos = $pos_348 ;
unset ( $res_348 );
unset ( $pos_348 );
2011-02-28 04:12:41 +01:00
}
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
if (( $subres = $this -> literal ( '%>' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_368 = FALSE ; break ; }
$res_351 = $result ;
$pos_351 = $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 07:37:57 +02:00
$result = $res_351 ;
$this -> pos = $pos_351 ;
unset ( $res_351 );
unset ( $pos_351 );
2011-02-28 04:12:41 +01:00
}
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_368 = 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 07:37:57 +02:00
else { $_368 = FALSE ; break ; }
$_364 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$_362 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_355 = $result ;
$pos_355 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'uncached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_362 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_355 ;
$this -> pos = $pos_355 ;
$_360 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_357 = $result ;
$pos_357 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_360 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_357 ;
$this -> pos = $pos_357 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cacheblock' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_360 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_357 ;
$this -> pos = $pos_357 ;
$_360 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_360 === TRUE ) { $_362 = TRUE ; break ; }
$result = $res_355 ;
$this -> pos = $pos_355 ;
$_362 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_362 === FALSE ) { $_364 = FALSE ; break ; }
$_364 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_364 === FALSE ) { $_368 = 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 07:37:57 +02:00
else { $_368 = FALSE ; break ; }
$_368 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_368 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_368 === FALSE ) { return FALSE ; }
2011-02-28 04:12:41 +01:00
}
2012-09-19 12:07:39 +02:00
public function UncachedBlock_Template ( & $res , $sub ){
2011-02-28 04:12:41 +01:00
$res [ 'php' ] = $sub [ 'php' ];
}
2012-04-16 07:37:57 +02:00
/* CacheRestrictedTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock | OpenBlock | MalformedBlock | Injection | Text)+ */
2011-02-28 04:12:41 +01:00
protected $match_CacheRestrictedTemplate_typestack = array ( 'CacheRestrictedTemplate' , 'Template' );
2012-09-19 12:07:39 +02:00
public function match_CacheRestrictedTemplate ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " CacheRestrictedTemplate " ; $result = $this -> construct ( $matchrule , $matchrule , null );
$count = 0 ;
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_420 = $result ;
$pos_420 = $this -> pos ;
$_419 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$_417 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_370 = $result ;
$pos_370 = $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 07:37:57 +02:00
$_417 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_370 ;
$this -> pos = $pos_370 ;
$_415 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_372 = $result ;
$pos_372 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'Translate' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_415 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_372 ;
$this -> pos = $pos_372 ;
$_413 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_374 = $result ;
$pos_374 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'If' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_413 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_374 ;
$this -> pos = $pos_374 ;
$_411 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_376 = $result ;
$pos_376 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'Require' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_411 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_376 ;
$this -> pos = $pos_376 ;
$_409 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_378 = $result ;
$pos_378 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'CacheBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_409 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_378 ;
$this -> pos = $pos_378 ;
$_407 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_380 = $result ;
$pos_380 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'UncachedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_407 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_380 ;
$this -> pos = $pos_380 ;
$_405 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_382 = $result ;
$pos_382 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'OldI18NTag' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_405 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_382 ;
$this -> pos = $pos_382 ;
$_403 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_384 = $result ;
$pos_384 = $this -> pos ;
$matcher = 'match_' . 'Include' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_403 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_384 ;
$this -> pos = $pos_384 ;
$_401 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_386 = $result ;
$pos_386 = $this -> pos ;
$matcher = 'match_' . 'ClosedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_401 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_386 ;
$this -> pos = $pos_386 ;
$_399 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_388 = $result ;
$pos_388 = $this -> pos ;
$matcher = 'match_' . 'OpenBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_399 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_388 ;
$this -> pos = $pos_388 ;
$_397 = NULL ;
2012-04-11 11:34:27 +02:00
do {
2012-04-16 07:37:57 +02:00
$res_390 = $result ;
$pos_390 = $this -> pos ;
$matcher = 'match_' . 'MalformedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2012-04-11 11:34:27 +02:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_397 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 07:37:57 +02:00
$result = $res_390 ;
$this -> pos = $pos_390 ;
$_395 = NULL ;
do {
$res_392 = $result ;
$pos_392 = $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 );
$_395 = TRUE ; break ;
}
$result = $res_392 ;
$this -> pos = $pos_392 ;
$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 );
$_395 = TRUE ; break ;
}
$result = $res_392 ;
$this -> pos = $pos_392 ;
$_395 = FALSE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 07:37:57 +02:00
while ( 0 );
if ( $_395 === TRUE ) { $_397 = TRUE ; break ; }
$result = $res_390 ;
$this -> pos = $pos_390 ;
$_397 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_397 === TRUE ) { $_399 = TRUE ; break ; }
$result = $res_388 ;
$this -> pos = $pos_388 ;
$_399 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_399 === TRUE ) { $_401 = TRUE ; break ; }
$result = $res_386 ;
$this -> pos = $pos_386 ;
$_401 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_401 === TRUE ) { $_403 = TRUE ; break ; }
$result = $res_384 ;
$this -> pos = $pos_384 ;
$_403 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_403 === TRUE ) { $_405 = TRUE ; break ; }
$result = $res_382 ;
$this -> pos = $pos_382 ;
$_405 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_405 === TRUE ) { $_407 = TRUE ; break ; }
$result = $res_380 ;
$this -> pos = $pos_380 ;
$_407 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_407 === TRUE ) { $_409 = TRUE ; break ; }
$result = $res_378 ;
$this -> pos = $pos_378 ;
$_409 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_409 === TRUE ) { $_411 = TRUE ; break ; }
$result = $res_376 ;
$this -> pos = $pos_376 ;
$_411 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_411 === TRUE ) { $_413 = TRUE ; break ; }
$result = $res_374 ;
$this -> pos = $pos_374 ;
$_413 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_413 === TRUE ) { $_415 = TRUE ; break ; }
$result = $res_372 ;
$this -> pos = $pos_372 ;
$_415 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_415 === TRUE ) { $_417 = TRUE ; break ; }
$result = $res_370 ;
$this -> pos = $pos_370 ;
$_417 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_417 === FALSE ) { $_419 = FALSE ; break ; }
$_419 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_419 === FALSE ) {
$result = $res_420 ;
$this -> pos = $pos_420 ;
unset ( $res_420 );
unset ( $pos_420 );
2011-02-28 04:12:41 +01:00
break ;
}
$count += 1 ;
}
if ( $count > 0 ) { return $this -> finalise ( $result ); }
else { return FALSE ; }
}
2012-09-19 12:07:39 +02:00
public function CacheRestrictedTemplate_CacheBlock ( & $res , $sub ) {
2011-02-28 04:12:41 +01:00
throw new SSTemplateParseException ( 'You cant have cache blocks nested within with, loop or control blocks that are within cache blocks' , $this );
}
2012-09-19 12:07:39 +02:00
public function CacheRestrictedTemplate_UncachedBlock ( & $res , $sub ) {
2011-02-28 04:12:41 +01:00
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' );
2012-09-19 12:07:39 +02:00
public function match_CacheBlock ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " CacheBlock " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_475 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_475 = 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 07:37:57 +02:00
$_428 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$_426 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_423 = $result ;
$pos_423 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_426 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_423 ;
$this -> pos = $pos_423 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cacheblock' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_426 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +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 07:37:57 +02:00
if ( $_426 === FALSE ) { $_428 = FALSE ; break ; }
$_428 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_428 === TRUE ) {
2011-02-28 04:12:41 +01:00
$subres = $result ; $result = array_pop ( $stack );
$this -> store ( $result , $subres , 'CacheTag' );
}
2012-04-16 07:37:57 +02:00
if ( $_428 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 07:37:57 +02:00
$_475 = 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 07:37:57 +02:00
$res_433 = $result ;
$pos_433 = $this -> pos ;
$_432 = 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 07:37:57 +02:00
else { $_432 = FALSE ; break ; }
$_432 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_432 === FALSE ) {
$result = $res_433 ;
$this -> pos = $pos_433 ;
unset ( $res_433 );
unset ( $pos_433 );
2012-04-16 06:59:56 +02:00
}
2012-04-16 07:37:57 +02:00
$res_445 = $result ;
$pos_445 = $this -> pos ;
$_444 = 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 07:37:57 +02:00
$_440 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$_438 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_435 = $result ;
$pos_435 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'if' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_438 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_435 ;
$this -> pos = $pos_435 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'unless' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_438 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_435 ;
$this -> pos = $pos_435 ;
$_438 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_438 === FALSE ) { $_440 = FALSE ; break ; }
$_440 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_440 === 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 07:37:57 +02:00
if ( $_440 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 07:37:57 +02:00
$_444 = 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 07:37:57 +02:00
else { $_444 = FALSE ; break ; }
$_444 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_444 === FALSE ) {
$result = $res_445 ;
$this -> pos = $pos_445 ;
unset ( $res_445 );
unset ( $pos_445 );
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 07:37:57 +02:00
else { $_475 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_458 = $result ;
$pos_458 = $this -> pos ;
$_457 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$_455 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_448 = $result ;
$pos_448 = $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 07:37:57 +02:00
$_455 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_448 ;
$this -> pos = $pos_448 ;
$_453 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_450 = $result ;
$pos_450 = $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 07:37:57 +02:00
$_453 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_450 ;
$this -> pos = $pos_450 ;
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 07:37:57 +02:00
$_453 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_450 ;
$this -> pos = $pos_450 ;
$_453 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_453 === TRUE ) { $_455 = TRUE ; break ; }
$result = $res_448 ;
$this -> pos = $pos_448 ;
$_455 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_455 === FALSE ) { $_457 = FALSE ; break ; }
$_457 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_457 === FALSE ) {
$result = $res_458 ;
$this -> pos = $pos_458 ;
unset ( $res_458 );
unset ( $pos_458 );
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 07:37:57 +02:00
else { $_475 = 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 07:37:57 +02:00
else { $_475 = FALSE ; break ; }
$_471 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$_469 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_462 = $result ;
$pos_462 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_469 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_462 ;
$this -> pos = $pos_462 ;
$_467 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_464 = $result ;
$pos_464 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'uncached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_467 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_464 ;
$this -> pos = $pos_464 ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cacheblock' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_467 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_464 ;
$this -> pos = $pos_464 ;
$_467 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_467 === TRUE ) { $_469 = TRUE ; break ; }
$result = $res_462 ;
$this -> pos = $pos_462 ;
$_469 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_469 === FALSE ) { $_471 = FALSE ; break ; }
$_471 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_471 === FALSE ) { $_475 = 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 07:37:57 +02:00
else { $_475 = FALSE ; break ; }
$_475 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_475 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_475 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function CacheBlock__construct ( & $res ){
2011-02-28 04:12:41 +01:00
$res [ 'subblocks' ] = 0 ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
2012-09-19 12:07:39 +02:00
public function CacheBlock_CacheBlockArguments ( & $res , $sub ){
2011-02-28 04:12:41 +01:00
$res [ 'key' ] = ! empty ( $sub [ 'php' ]) ? $sub [ 'php' ] : '' ;
}
2012-09-19 12:07:39 +02:00
public function CacheBlock_Condition ( & $res , $sub ){
2011-02-28 04:12:41 +01:00
$res [ 'condition' ] = ( $res [ 'Conditional' ][ 'text' ] == 'if' ? '(' : '!(' ) . $sub [ 'php' ] . ') && ' ;
}
2012-09-19 12:07:39 +02:00
public function CacheBlock_CacheBlock ( & $res , $sub ){
2011-02-28 04:12:41 +01:00
$res [ 'php' ] .= $sub [ 'php' ];
}
2012-09-19 12:07:39 +02:00
public function CacheBlock_UncachedBlock ( & $res , $sub ){
2011-02-28 04:12:41 +01:00
$res [ 'php' ] .= $sub [ 'php' ];
}
2012-09-19 12:07:39 +02:00
public function CacheBlock_CacheBlockTemplate ( & $res , $sub ){
2011-02-28 04:12:41 +01:00
// 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' );
2012-09-19 12:07:39 +02:00
public function match_OldTPart ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " OldTPart " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_494 = 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 07:37:57 +02:00
else { $_494 = FALSE ; break ; }
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'N' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-16 07:37:57 +02:00
else { $_494 = 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 07:37:57 +02:00
else { $_494 = FALSE ; break ; }
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'N' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-16 07:37:57 +02:00
else { $_494 = 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 07:37:57 +02:00
else { $_494 = FALSE ; break ; }
$res_487 = $result ;
$pos_487 = $this -> pos ;
$_486 = 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 ); }
2012-04-16 07:37:57 +02:00
else { $_486 = 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 07:37:57 +02:00
else { $_486 = FALSE ; break ; }
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'N' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-16 07:37:57 +02:00
else { $_486 = 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 07:37:57 +02:00
else { $_486 = FALSE ; break ; }
$_486 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_486 === FALSE ) {
$result = $res_487 ;
$this -> pos = $pos_487 ;
unset ( $res_487 );
unset ( $pos_487 );
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 ); }
2012-04-16 07:37:57 +02:00
else { $_494 = 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 07:37:57 +02:00
else { $_494 = FALSE ; break ; }
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'N' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-16 07:37:57 +02:00
else { $_494 = FALSE ; break ; }
$res_493 = $result ;
$pos_493 = $this -> pos ;
$_492 = NULL ;
2012-04-16 06:59:56 +02:00
do {
if ( substr ( $this -> string , $this -> pos , 1 ) == ';' ) {
$this -> pos += 1 ;
$result [ " text " ] .= ';' ;
}
2012-04-16 07:37:57 +02:00
else { $_492 = FALSE ; break ; }
$_492 = TRUE ; break ;
2012-04-16 06:59:56 +02:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_492 === FALSE ) {
$result = $res_493 ;
$this -> pos = $pos_493 ;
unset ( $res_493 );
unset ( $pos_493 );
2012-04-16 06:59:56 +02:00
}
2012-04-16 07:37:57 +02:00
$_494 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_494 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_494 === FALSE ) { return FALSE ; }
2012-04-16 06:59:56 +02:00
}
/* N: / [\s\n]* / */
protected $match_N_typestack = array ( 'N' );
2012-09-19 12:07:39 +02:00
public function match_N ( $stack = array ()) {
2012-04-16 06:59:56 +02:00
$matchrule = " N " ; $result = $this -> construct ( $matchrule , $matchrule , null );
if (( $subres = $this -> rx ( '/ [\s\n]* /' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
return $this -> finalise ( $result );
}
else { return FALSE ; }
2011-02-21 05:44:46 +01:00
}
2012-09-19 12:07:39 +02:00
public function OldTPart__construct ( & $res ) {
2011-02-21 05:44:46 +01:00
$res [ 'php' ] = " _t( " ;
}
2012-09-19 12:07:39 +02:00
public function OldTPart_QuotedString ( & $res , $sub ) {
2011-02-21 05:44:46 +01:00
$entity = $sub [ 'String' ][ 'text' ];
if ( strpos ( $entity , '.' ) === false ) {
$res [ 'php' ] .= " \$ scope->XML_val('I18NNamespace').'. $entity ' " ;
}
else {
$res [ 'php' ] .= " ' $entity ' " ;
}
}
2012-09-19 12:07:39 +02:00
public function OldTPart_CallArguments ( & $res , $sub ) {
2011-02-21 05:44:46 +01:00
$res [ 'php' ] .= ',' . $sub [ 'php' ];
}
2012-09-19 12:07:39 +02:00
public function OldTPart__finalise ( & $res ) {
2011-02-21 05:44:46 +01:00
$res [ 'php' ] .= ')' ;
}
/* OldTTag: "<%" < OldTPart > "%>" */
2011-02-28 04:12:41 +01:00
protected $match_OldTTag_typestack = array ( 'OldTTag' );
2012-09-19 12:07:39 +02:00
public function match_OldTTag ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " OldTTag " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_502 = 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 07:37:57 +02:00
else { $_502 = 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 07:37:57 +02:00
else { $_502 = 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 07:37:57 +02:00
else { $_502 = FALSE ; break ; }
$_502 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_502 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_502 === FALSE ) { return FALSE ; }
2011-02-21 05:44:46 +01:00
}
2012-09-19 12:07:39 +02:00
public function OldTTag_OldTPart ( & $res , $sub ) {
2011-02-21 05:44:46 +01:00
$res [ 'php' ] = $sub [ 'php' ];
}
/* OldSprintfTag: "<%" < "sprintf" < "(" < OldTPart < "," < CallArguments > ")" > "%>" */
2011-02-28 04:12:41 +01:00
protected $match_OldSprintfTag_typestack = array ( 'OldSprintfTag' );
2012-09-19 12:07:39 +02:00
public function match_OldSprintfTag ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " OldSprintfTag " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_519 = NULL ;
2011-02-21 05:44:46 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_519 = FALSE ; break ; }
2011-02-21 05:44:46 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'sprintf' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_519 = FALSE ; break ; }
2011-02-21 05:44:46 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
if ( 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 07:37:57 +02:00
else { $_519 = FALSE ; break ; }
2011-02-21 05:44:46 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'OldTPart' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-21 05:44:46 +01:00
if ( $subres !== FALSE ) { $this -> store ( $result , $subres ); }
2012-04-16 07:37:57 +02:00
else { $_519 = FALSE ; break ; }
2011-02-21 05:44:46 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
if ( 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 07:37:57 +02:00
else { $_519 = FALSE ; break ; }
2011-02-21 05:44:46 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . '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 07:37:57 +02:00
else { $_519 = FALSE ; break ; }
2011-02-21 05:44:46 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
if ( 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 07:37:57 +02:00
else { $_519 = FALSE ; break ; }
2011-02-21 05:44:46 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '%>' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_519 = FALSE ; break ; }
$_519 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_519 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_519 === FALSE ) { return FALSE ; }
2011-02-21 05:44:46 +01:00
}
2012-09-19 12:07:39 +02:00
public function OldSprintfTag__construct ( & $res ) {
2011-02-21 05:44:46 +01:00
$res [ 'php' ] = " sprintf( " ;
}
2012-09-19 12:07:39 +02:00
public function OldSprintfTag_OldTPart ( & $res , $sub ) {
2011-02-21 05:44:46 +01:00
$res [ 'php' ] .= $sub [ 'php' ];
}
2012-09-19 12:07:39 +02:00
public function OldSprintfTag_CallArguments ( & $res , $sub ) {
2011-02-21 05:44:46 +01:00
$res [ 'php' ] .= ',' . $sub [ 'php' ] . ')' ;
}
/* OldI18NTag: OldSprintfTag | OldTTag */
2011-02-28 04:12:41 +01:00
protected $match_OldI18NTag_typestack = array ( 'OldI18NTag' );
2012-09-19 12:07:39 +02:00
public function match_OldI18NTag ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " OldI18NTag " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_524 = NULL ;
2011-02-21 05:44:46 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_521 = $result ;
$pos_521 = $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 07:37:57 +02:00
$_524 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_521 ;
$this -> pos = $pos_521 ;
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 07:37:57 +02:00
$_524 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_521 ;
$this -> pos = $pos_521 ;
$_524 = FALSE ; break ;
2011-02-21 05:44:46 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_524 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_524 === FALSE ) { return FALSE ; }
2011-02-21 05:44:46 +01:00
}
2012-09-19 12:07:39 +02:00
public function OldI18NTag_STR ( & $res , $sub ) {
2011-02-21 05:44:46 +01:00
$res [ 'php' ] = '$val .= ' . $sub [ 'php' ] . ';' ;
}
2012-04-11 11:34:27 +02:00
/* NamedArgument: Name:Word "=" Value:Argument */
protected $match_NamedArgument_typestack = array ( 'NamedArgument' );
2012-09-19 12:07:39 +02:00
public function match_NamedArgument ( $stack = array ()) {
2012-04-11 11:34:27 +02:00
$matchrule = " NamedArgument " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_529 = 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 07:37:57 +02:00
else { $_529 = 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 07:37:57 +02:00
else { $_529 = 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 07:37:57 +02:00
else { $_529 = FALSE ; break ; }
$_529 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_529 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_529 === FALSE ) { return FALSE ; }
2012-04-11 11:34:27 +02:00
}
2012-09-19 12:07:39 +02:00
public function NamedArgument_Name ( & $res , $sub ) {
2012-04-11 11:34:27 +02:00
$res [ 'php' ] = " ' " . $sub [ 'text' ] . " ' => " ;
}
2012-09-19 12:07:39 +02:00
public function NamedArgument_Value ( & $res , $sub ) {
2012-04-11 11:34:27 +02:00
$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' );
2012-09-19 12:07:39 +02:00
public function match_Include ( $stack = array ()) {
2012-04-11 11:34:27 +02:00
$matchrule = " Include " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_548 = NULL ;
2012-04-11 11:34:27 +02:00
do {
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_548 = 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 07:37:57 +02:00
else { $_548 = 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 07:37:57 +02:00
else { $_548 = FALSE ; break ; }
2012-04-11 11:34:27 +02:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
$res_545 = $result ;
$pos_545 = $this -> pos ;
$_544 = 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 07:37:57 +02:00
else { $_544 = FALSE ; break ; }
2012-04-11 11:34:27 +02:00
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_543 = $result ;
$pos_543 = $this -> pos ;
$_542 = 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 07:37:57 +02:00
else { $_542 = 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 07:37:57 +02:00
else { $_542 = FALSE ; break ; }
$_542 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_542 === FALSE ) {
$result = $res_543 ;
$this -> pos = $pos_543 ;
unset ( $res_543 );
unset ( $pos_543 );
2012-04-11 11:34:27 +02:00
break ;
}
}
2012-04-16 07:37:57 +02:00
$_544 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_544 === FALSE ) {
$result = $res_545 ;
$this -> pos = $pos_545 ;
unset ( $res_545 );
unset ( $pos_545 );
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 07:37:57 +02:00
else { $_548 = FALSE ; break ; }
$_548 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_548 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_548 === FALSE ) { return FALSE ; }
2012-04-11 11:34:27 +02:00
}
2012-09-19 12:07:39 +02:00
public function Include__construct ( & $res ){
2012-04-11 11:34:27 +02:00
$res [ 'arguments' ] = array ();
}
2012-09-19 12:07:39 +02:00
public function Include_Template ( & $res , $sub ){
2012-04-11 11:34:27 +02:00
$res [ 'template' ] = " ' " . $sub [ 'text' ] . " ' " ;
}
2012-09-19 12:07:39 +02:00
public function Include_NamedArgument ( & $res , $sub ){
2012-04-11 11:34:27 +02:00
$res [ 'arguments' ][] = $sub [ 'php' ];
}
2012-09-19 12:07:39 +02:00
public function Include__finalise ( & $res ){
2012-04-11 11:34:27 +02:00
$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' );
2012-09-19 12:07:39 +02:00
public function match_BlockArguments ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " BlockArguments " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_557 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Argument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Argument " );
}
2012-04-16 07:37:57 +02:00
else { $_557 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_556 = $result ;
$pos_556 = $this -> pos ;
$_555 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
if ( substr ( $this -> string , $this -> pos , 1 ) == ',' ) {
2011-02-09 05:31:16 +01:00
$this -> pos += 1 ;
2011-02-28 04:12:41 +01:00
$result [ " text " ] .= ',' ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
else { $_555 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
$matcher = 'match_' . 'Argument' ; $key = $matcher ; $pos = $this -> pos ;
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres , " Argument " );
}
2012-04-16 07:37:57 +02:00
else { $_555 = FALSE ; break ; }
$_555 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_555 === FALSE ) {
$result = $res_556 ;
$this -> pos = $pos_556 ;
unset ( $res_556 );
unset ( $pos_556 );
2011-02-09 05:31:16 +01:00
break ;
}
}
2012-04-16 07:37:57 +02:00
$_557 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_557 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_557 === 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' );
2012-09-19 12:07:39 +02:00
public function match_NotBlockTag ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " NotBlockTag " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_595 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_559 = $result ;
$pos_559 = $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 07:37:57 +02:00
$_595 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_559 ;
$this -> pos = $pos_559 ;
$_593 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$_590 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$_588 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_561 = $result ;
$pos_561 = $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 07:37:57 +02:00
$_588 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_561 ;
$this -> pos = $pos_561 ;
$_586 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_563 = $result ;
$pos_563 = $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 07:37:57 +02:00
$_586 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_563 ;
$this -> pos = $pos_563 ;
$_584 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_565 = $result ;
$pos_565 = $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 07:37:57 +02:00
$_584 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_565 ;
$this -> pos = $pos_565 ;
$_582 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_567 = $result ;
$pos_567 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'require' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_582 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_567 ;
$this -> pos = $pos_567 ;
$_580 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_569 = $result ;
$pos_569 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'cached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_580 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_569 ;
$this -> pos = $pos_569 ;
$_578 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_571 = $result ;
$pos_571 = $this -> pos ;
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( 'uncached' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_578 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_571 ;
$this -> pos = $pos_571 ;
$_576 = NULL ;
2012-04-11 11:34:27 +02:00
do {
2012-04-16 07:37:57 +02:00
$res_573 = $result ;
$pos_573 = $this -> pos ;
2012-04-11 11:34:27 +02:00
if (( $subres = $this -> literal ( 'cacheblock' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_576 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 07:37:57 +02:00
$result = $res_573 ;
$this -> pos = $pos_573 ;
2012-04-11 11:34:27 +02:00
if (( $subres = $this -> literal ( 'include' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_576 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 07:37:57 +02:00
$result = $res_573 ;
$this -> pos = $pos_573 ;
$_576 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_576 === TRUE ) { $_578 = TRUE ; break ; }
$result = $res_571 ;
$this -> pos = $pos_571 ;
$_578 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_578 === TRUE ) { $_580 = TRUE ; break ; }
$result = $res_569 ;
$this -> pos = $pos_569 ;
$_580 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_580 === TRUE ) { $_582 = TRUE ; break ; }
$result = $res_567 ;
$this -> pos = $pos_567 ;
$_582 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-28 04:12:41 +01:00
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_582 === TRUE ) { $_584 = TRUE ; break ; }
$result = $res_565 ;
$this -> pos = $pos_565 ;
$_584 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_584 === TRUE ) { $_586 = TRUE ; break ; }
$result = $res_563 ;
$this -> pos = $pos_563 ;
$_586 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_586 === TRUE ) { $_588 = TRUE ; break ; }
$result = $res_561 ;
$this -> pos = $pos_561 ;
$_588 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_588 === FALSE ) { $_590 = FALSE ; break ; }
$_590 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_590 === FALSE ) { $_593 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_593 = FALSE ; break ; }
$_593 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_593 === TRUE ) { $_595 = TRUE ; break ; }
$result = $res_559 ;
$this -> pos = $pos_559 ;
$_595 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_595 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_595 === 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' );
2012-09-19 12:07:39 +02:00
public function match_ClosedBlock ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " ClosedBlock " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_615 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_615 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
$res_599 = $result ;
$pos_599 = $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 07:37:57 +02:00
$result = $res_599 ;
$this -> pos = $pos_599 ;
$_615 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-16 07:37:57 +02:00
$result = $res_599 ;
$this -> pos = $pos_599 ;
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 07:37:57 +02:00
else { $_615 = FALSE ; break ; }
$res_605 = $result ;
$pos_605 = $this -> pos ;
$_604 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_604 = 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 07:37:57 +02:00
else { $_604 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_604 = FALSE ; break ; }
$_604 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_604 === FALSE ) {
$result = $res_605 ;
$this -> pos = $pos_605 ;
unset ( $res_605 );
unset ( $pos_605 );
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 07:37:57 +02:00
$_615 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$res_608 = $result ;
$pos_608 = $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 07:37:57 +02:00
$result = $res_608 ;
$this -> pos = $pos_608 ;
unset ( $res_608 );
unset ( $pos_608 );
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 07:37:57 +02:00
else { $_615 = 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 07:37:57 +02:00
else { $_615 = 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 07:37:57 +02:00
else { $_615 = 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 07:37:57 +02:00
else { $_615 = FALSE ; break ; }
$_615 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_615 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_615 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2011-02-14 22:03:42 +01:00
/**
* As mentioned in the parser comment , block handling is kept fairly generic for extensibility . The match rule
* builds up two important elements in the match result array :
* 'ArgumentCount' - how many arguments were passed in the opening tag
* 'Arguments' an array of the Argument match rule result arrays
*
* Once a block has successfully been matched against , it will then look for the actual handler , which should
2011-04-15 11:35:30 +02:00
* be on this class ( either defined or extended on ) as ClosedBlock_Handler_Name ( & $res ), where Name is the
2011-02-14 22:03:42 +01:00
* tag name , first letter captialized ( i . e Control , Loop , With , etc ) .
*
* This function will be called with the match rule result array as it ' s first argument . It should return
* the php result of this block as it ' s return value , or throw an error if incorrect arguments were passed .
*/
2012-09-19 12:07:39 +02:00
public function ClosedBlock__construct ( & $res ) {
2011-02-09 05:31:16 +01:00
$res [ 'ArgumentCount' ] = 0 ;
}
2012-09-19 12:07:39 +02:00
public function ClosedBlock_BlockArguments ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
if ( isset ( $sub [ 'Argument' ][ 'ArgumentMode' ])) {
$res [ 'Arguments' ] = array ( $sub [ 'Argument' ]);
$res [ 'ArgumentCount' ] = 1 ;
}
else {
$res [ 'Arguments' ] = $sub [ 'Argument' ];
$res [ 'ArgumentCount' ] = count ( $res [ 'Arguments' ]);
}
}
2012-09-19 12:07:39 +02:00
public function ClosedBlock__finalise ( & $res ) {
2011-02-09 05:31:16 +01:00
$blockname = $res [ 'BlockName' ][ 'text' ];
2011-12-17 05:35:26 +01:00
$method = 'ClosedBlock_Handle_' . $blockname ;
2011-02-09 05:31:16 +01:00
if ( method_exists ( $this , $method )) $res [ 'php' ] = $this -> $method ( $res );
else {
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
*/
2012-09-19 12:07:39 +02:00
public 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
*/
2012-09-19 12:07:39 +02:00
public 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
*/
2012-09-19 12:07:39 +02:00
public function ClosedBlock_Handle_With ( & $res ) {
2011-02-18 05:06:11 +01:00
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' );
2012-09-19 12:07:39 +02:00
public function match_OpenBlock ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " OpenBlock " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_628 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_628 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
$res_619 = $result ;
$pos_619 = $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 07:37:57 +02:00
$result = $res_619 ;
$this -> pos = $pos_619 ;
$_628 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-16 07:37:57 +02:00
$result = $res_619 ;
$this -> pos = $pos_619 ;
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 07:37:57 +02:00
else { $_628 = FALSE ; break ; }
$res_625 = $result ;
$pos_625 = $this -> pos ;
$_624 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_624 = 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 07:37:57 +02:00
else { $_624 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_624 = FALSE ; break ; }
$_624 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_624 === FALSE ) {
$result = $res_625 ;
$this -> pos = $pos_625 ;
unset ( $res_625 );
unset ( $pos_625 );
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 07:37:57 +02:00
else { $_628 = FALSE ; break ; }
$_628 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_628 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_628 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function OpenBlock__construct ( & $res ) {
2011-02-09 05:31:16 +01:00
$res [ 'ArgumentCount' ] = 0 ;
}
2012-09-19 12:07:39 +02:00
public function OpenBlock_BlockArguments ( & $res , $sub ) {
2011-02-09 05:31:16 +01:00
if ( isset ( $sub [ 'Argument' ][ 'ArgumentMode' ])) {
$res [ 'Arguments' ] = array ( $sub [ 'Argument' ]);
$res [ 'ArgumentCount' ] = 1 ;
}
else {
$res [ 'Arguments' ] = $sub [ 'Argument' ];
$res [ 'ArgumentCount' ] = count ( $res [ 'Arguments' ]);
}
}
2012-09-19 12:07:39 +02:00
public 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
*/
2012-09-19 12:07:39 +02:00
public function OpenBlock_Handle_Debug ( & $res ) {
2011-02-18 05:06:11 +01:00
if ( $res [ 'ArgumentCount' ] == 0 ) return '$scope->debug();' ;
2011-02-09 05:31:16 +01:00
else if ( $res [ 'ArgumentCount' ] == 1 ) {
$arg = $res [ 'Arguments' ][ 0 ];
if ( $arg [ 'ArgumentMode' ] == 'string' ) return 'Debug::show(' . $arg [ 'php' ] . ');' ;
$php = ( $arg [ 'ArgumentMode' ] == 'default' ) ? $arg [ 'lookup_php' ] : $arg [ 'php' ];
return '$val .= Debug::show(' . str_replace ( 'FINALGET!' , 'cachedCall' , $php ) . ');' ;
}
else {
throw new SSTemplateParseException ( 'Debug takes 0 or 1 argument only.' , $this );
}
}
2011-02-14 22:03:42 +01:00
/**
* This is an open block handler , for the <% base_tag %> tag
*/
2012-09-19 12:07:39 +02:00
public function OpenBlock_Handle_Base_tag ( & $res ) {
2011-02-09 05:31:16 +01:00
if ( $res [ 'ArgumentCount' ] != 0 ) throw new SSTemplateParseException ( 'Base_tag takes no arguments' , $this );
return '$val .= SSViewer::get_base_tag($val);' ;
}
2011-02-14 22:03:42 +01:00
/**
* This is an open block handler , for the <% current_page %> tag
*/
2012-09-19 12:07:39 +02:00
public function OpenBlock_Handle_Current_page ( & $res ) {
2011-02-09 05:31:16 +01:00
if ( $res [ 'ArgumentCount' ] != 0 ) throw new SSTemplateParseException ( 'Current_page takes no arguments' , $this );
return '$val .= $_SERVER[SCRIPT_URL];' ;
}
2011-02-28 04:12:41 +01:00
/* MismatchedEndBlock: '<%' < 'end_' :Word > '%>' */
protected $match_MismatchedEndBlock_typestack = array ( 'MismatchedEndBlock' );
2012-09-19 12:07:39 +02:00
public function match_MismatchedEndBlock ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " MismatchedEndBlock " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_636 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_636 = 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 07:37:57 +02:00
else { $_636 = 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 07:37:57 +02:00
else { $_636 = 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 07:37:57 +02:00
else { $_636 = FALSE ; break ; }
$_636 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_636 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_636 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function MismatchedEndBlock__finalise ( & $res ) {
2011-02-09 05:31:16 +01:00
$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' );
2012-09-19 12:07:39 +02:00
public function match_MalformedOpenTag ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " MalformedOpenTag " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +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 07:37:57 +02:00
else { $_651 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
$res_640 = $result ;
$pos_640 = $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 07:37:57 +02:00
$result = $res_640 ;
$this -> pos = $pos_640 ;
$_651 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-16 07:37:57 +02:00
$result = $res_640 ;
$this -> pos = $pos_640 ;
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 07:37:57 +02:00
else { $_651 = FALSE ; break ; }
$res_650 = $result ;
$pos_650 = $this -> pos ;
$_649 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_646 = $result ;
$pos_646 = $this -> pos ;
$_645 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_645 = 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 07:37:57 +02:00
else { $_645 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_645 = FALSE ; break ; }
$_645 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_645 === FALSE ) {
$result = $res_646 ;
$this -> pos = $pos_646 ;
unset ( $res_646 );
unset ( $pos_646 );
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 07:37:57 +02:00
else { $_649 = FALSE ; break ; }
$_649 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +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 07:37:57 +02:00
if ( $_649 === FALSE ) {
$result = $res_650 ;
$this -> pos = $pos_650 ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$_651 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_651 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_651 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function MalformedOpenTag__finalise ( & $res ) {
2011-02-09 05:31:16 +01:00
$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' );
2012-09-19 12:07:39 +02:00
public function match_MalformedCloseTag ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " MalformedCloseTag " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_663 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_663 = 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 07:37:57 +02:00
$_657 = 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 07:37:57 +02:00
else { $_657 = 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 07:37:57 +02:00
else { $_657 = FALSE ; break ; }
$_657 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_657 === 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 07:37:57 +02:00
if ( $_657 === FALSE ) {
2011-02-28 04:12:41 +01:00
$result = array_pop ( $stack );
2012-04-16 07:37:57 +02:00
$_663 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$res_662 = $result ;
$pos_662 = $this -> pos ;
$_661 = NULL ;
2011-02-09 05:31:16 +01:00
do {
if (( $subres = $this -> whitespace ( ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '%>' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_661 = FALSE ; break ; }
$_661 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_661 === TRUE ) {
$result = $res_662 ;
$this -> pos = $pos_662 ;
$_663 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
if ( $_661 === FALSE ) {
$result = $res_662 ;
$this -> pos = $pos_662 ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$_663 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_663 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_663 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function MalformedCloseTag__finalise ( & $res ) {
2011-02-09 05:31:16 +01:00
$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' );
2012-09-19 12:07:39 +02:00
public function match_MalformedBlock ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " MalformedBlock " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_668 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_665 = $result ;
$pos_665 = $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 07:37:57 +02:00
$_668 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_665 ;
$this -> pos = $pos_665 ;
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 07:37:57 +02:00
$_668 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_665 ;
$this -> pos = $pos_665 ;
$_668 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_668 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_668 === 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' );
2012-09-19 12:07:39 +02:00
public function match_Comment ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " Comment " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2012-04-16 07:37:57 +02:00
$_676 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '<%--' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_676 = FALSE ; break ; }
2011-02-09 05:31:16 +01:00
$count = 0 ;
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_674 = $result ;
$pos_674 = $this -> pos ;
$_673 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_671 = $result ;
$pos_671 = $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 07:37:57 +02:00
$result = $res_671 ;
$this -> pos = $pos_671 ;
$_673 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
else {
2012-04-16 07:37:57 +02:00
$result = $res_671 ;
$this -> pos = $pos_671 ;
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 07:37:57 +02:00
else { $_673 = FALSE ; break ; }
$_673 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_673 === FALSE ) {
$result = $res_674 ;
$this -> pos = $pos_674 ;
unset ( $res_674 );
unset ( $pos_674 );
2011-02-09 05:31:16 +01:00
break ;
}
$count += 1 ;
}
if ( $count > 0 ) { }
2012-04-16 07:37:57 +02:00
else { $_676 = FALSE ; break ; }
2011-02-28 04:12:41 +01:00
if (( $subres = $this -> literal ( '--%>' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_676 = FALSE ; break ; }
$_676 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_676 === TRUE ) { return $this -> finalise ( $result ); }
if ( $_676 === FALSE ) { return FALSE ; }
2011-02-09 05:31:16 +01:00
}
2012-09-19 12:07:39 +02:00
public function Comment__construct ( & $res ) {
2011-02-09 05:31:16 +01:00
$res [ 'php' ] = '' ;
}
2012-04-16 07:37:57 +02:00
/* TopTemplate: (Comment | Translate | If | Require | CacheBlock | UncachedBlock | OldI18NTag | Include | ClosedBlock | OpenBlock | MalformedBlock | MismatchedEndBlock | Injection | Text)+ */
2011-02-28 04:12:41 +01:00
protected $match_TopTemplate_typestack = array ( 'TopTemplate' , 'Template' );
2012-09-19 12:07:39 +02:00
public function match_TopTemplate ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " TopTemplate " ; $result = $this -> construct ( $matchrule , $matchrule , array ( 'TemplateMatcher' => 'Template' ));
2011-02-09 05:31:16 +01:00
$count = 0 ;
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_732 = $result ;
$pos_732 = $this -> pos ;
$_731 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$_729 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_678 = $result ;
$pos_678 = $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 07:37:57 +02:00
$_729 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_678 ;
$this -> pos = $pos_678 ;
$_727 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_680 = $result ;
$pos_680 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'Translate' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_727 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_680 ;
$this -> pos = $pos_680 ;
$_725 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_682 = $result ;
$pos_682 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'If' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_725 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_682 ;
$this -> pos = $pos_682 ;
$_723 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_684 = $result ;
$pos_684 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'Require' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_723 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_684 ;
$this -> pos = $pos_684 ;
$_721 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_686 = $result ;
$pos_686 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'CacheBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_721 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_686 ;
$this -> pos = $pos_686 ;
$_719 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_688 = $result ;
$pos_688 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'UncachedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_719 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_688 ;
$this -> pos = $pos_688 ;
$_717 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_690 = $result ;
$pos_690 = $this -> pos ;
2012-04-16 06:59:56 +02:00
$matcher = 'match_' . 'OldI18NTag' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_717 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_690 ;
$this -> pos = $pos_690 ;
$_715 = NULL ;
2011-02-09 05:31:16 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_692 = $result ;
$pos_692 = $this -> pos ;
$matcher = 'match_' . 'Include' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-09 05:31:16 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_715 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_692 ;
$this -> pos = $pos_692 ;
$_713 = NULL ;
2011-02-21 05:44:46 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_694 = $result ;
$pos_694 = $this -> pos ;
$matcher = 'match_' . 'ClosedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
2011-02-21 05:44:46 +01:00
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_713 = TRUE ; break ;
2011-02-21 05:44:46 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_694 ;
$this -> pos = $pos_694 ;
$_711 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_696 = $result ;
$pos_696 = $this -> pos ;
$matcher = 'match_' . 'OpenBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_711 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_696 ;
$this -> pos = $pos_696 ;
$_709 = NULL ;
2011-02-28 04:12:41 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_698 = $result ;
$pos_698 = $this -> pos ;
$matcher = 'match_' . 'MalformedBlock' ; $key = $matcher ; $pos = $this -> pos ;
2011-02-28 04:12:41 +01:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_709 = TRUE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_698 ;
$this -> pos = $pos_698 ;
$_707 = NULL ;
2012-04-11 11:34:27 +02:00
do {
2012-04-16 07:37:57 +02:00
$res_700 = $result ;
$pos_700 = $this -> pos ;
$matcher = 'match_' . 'MismatchedEndBlock' ; $key = $matcher ; $pos = $this -> pos ;
2012-04-11 11:34:27 +02:00
$subres = ( $this -> packhas ( $key , $pos ) ? $this -> packread ( $key , $pos ) : $this -> packwrite ( $key , $pos , $this -> $matcher ( array_merge ( $stack , array ( $result ))) ) );
if ( $subres !== FALSE ) {
$this -> store ( $result , $subres );
2012-04-16 07:37:57 +02:00
$_707 = TRUE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 07:37:57 +02:00
$result = $res_700 ;
$this -> pos = $pos_700 ;
$_705 = NULL ;
do {
$res_702 = $result ;
$pos_702 = $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 );
$_705 = TRUE ; break ;
}
$result = $res_702 ;
$this -> pos = $pos_702 ;
$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 );
$_705 = TRUE ; break ;
}
$result = $res_702 ;
$this -> pos = $pos_702 ;
$_705 = FALSE ; break ;
2012-04-11 11:34:27 +02:00
}
2012-04-16 07:37:57 +02:00
while ( 0 );
if ( $_705 === TRUE ) { $_707 = TRUE ; break ; }
$result = $res_700 ;
$this -> pos = $pos_700 ;
$_707 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
2012-04-11 11:34:27 +02:00
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_707 === TRUE ) { $_709 = TRUE ; break ; }
$result = $res_698 ;
$this -> pos = $pos_698 ;
$_709 = FALSE ; break ;
2011-02-28 04:12:41 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_709 === TRUE ) { $_711 = TRUE ; break ; }
$result = $res_696 ;
$this -> pos = $pos_696 ;
$_711 = FALSE ; break ;
2011-02-21 05:44:46 +01:00
}
2011-02-28 04:12:41 +01:00
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_711 === TRUE ) { $_713 = TRUE ; break ; }
$result = $res_694 ;
$this -> pos = $pos_694 ;
$_713 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
2011-02-21 05:44:46 +01:00
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_713 === TRUE ) { $_715 = TRUE ; break ; }
$result = $res_692 ;
$this -> pos = $pos_692 ;
$_715 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_715 === TRUE ) { $_717 = TRUE ; break ; }
$result = $res_690 ;
$this -> pos = $pos_690 ;
$_717 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_717 === TRUE ) { $_719 = TRUE ; break ; }
$result = $res_688 ;
$this -> pos = $pos_688 ;
$_719 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_719 === TRUE ) { $_721 = TRUE ; break ; }
$result = $res_686 ;
$this -> pos = $pos_686 ;
$_721 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_721 === TRUE ) { $_723 = TRUE ; break ; }
$result = $res_684 ;
$this -> pos = $pos_684 ;
$_723 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_723 === TRUE ) { $_725 = TRUE ; break ; }
$result = $res_682 ;
$this -> pos = $pos_682 ;
$_725 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_725 === TRUE ) { $_727 = TRUE ; break ; }
$result = $res_680 ;
$this -> pos = $pos_680 ;
$_727 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_727 === TRUE ) { $_729 = TRUE ; break ; }
$result = $res_678 ;
$this -> pos = $pos_678 ;
$_729 = FALSE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_729 === FALSE ) { $_731 = FALSE ; break ; }
$_731 = TRUE ; break ;
2011-02-09 05:31:16 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_731 === FALSE ) {
$result = $res_732 ;
$this -> pos = $pos_732 ;
unset ( $res_732 );
unset ( $pos_732 );
2011-02-09 05:31:16 +01:00
break ;
}
$count += 1 ;
}
2011-02-28 04:12:41 +01:00
if ( $count > 0 ) { return $this -> finalise ( $result ); }
2011-02-09 05:31:16 +01:00
else { return FALSE ; }
}
2011-02-14 22:03:42 +01:00
/**
* The TopTemplate also includes the opening stanza to start off the template
*/
2012-09-19 12:07:39 +02:00
public function TopTemplate__construct ( & $res ) {
2011-02-09 05:31:16 +01:00
$res [ 'php' ] = " <?php " . PHP_EOL ;
}
2011-03-17 01:08:13 +01:00
/* Text : (
/ [ ^< $ { \\ ] + / |
/ ( \\ . ) / |
'<' ! '%' |
'$' ! ( / [ A - Za - z_ ] / ) |
'{' ! '$' |
'{$' ! ( / [ A - Za - z_ ] / )
) + */
2011-02-28 04:12:41 +01:00
protected $match_Text_typestack = array ( 'Text' );
2012-09-19 12:07:39 +02:00
public function match_Text ( $stack = array ()) {
2011-02-28 04:12:41 +01:00
$matchrule = " Text " ; $result = $this -> construct ( $matchrule , $matchrule , null );
2011-03-17 01:08:13 +01:00
$count = 0 ;
while ( true ) {
2012-04-16 07:37:57 +02:00
$res_771 = $result ;
$pos_771 = $this -> pos ;
$_770 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-16 07:37:57 +02:00
$_768 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_733 = $result ;
$pos_733 = $this -> pos ;
2011-03-17 01:08:13 +01:00
if (( $subres = $this -> rx ( '/ [^<${\\\\]+ /' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_768 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_733 ;
$this -> pos = $pos_733 ;
$_766 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_735 = $result ;
$pos_735 = $this -> pos ;
2011-03-17 01:08:13 +01:00
if (( $subres = $this -> rx ( '/ (\\\\.) /' ) ) !== FALSE ) {
$result [ " text " ] .= $subres ;
2012-04-16 07:37:57 +02:00
$_766 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 07:37:57 +02:00
$result = $res_735 ;
$this -> pos = $pos_735 ;
$_764 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_737 = $result ;
$pos_737 = $this -> pos ;
$_740 = 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 07:37:57 +02:00
else { $_740 = FALSE ; break ; }
$res_739 = $result ;
$pos_739 = $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 07:37:57 +02:00
$result = $res_739 ;
$this -> pos = $pos_739 ;
$_740 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
else {
2012-04-16 07:37:57 +02:00
$result = $res_739 ;
$this -> pos = $pos_739 ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 07:37:57 +02:00
$_740 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_740 === TRUE ) { $_764 = TRUE ; break ; }
$result = $res_737 ;
$this -> pos = $pos_737 ;
$_762 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_742 = $result ;
$pos_742 = $this -> pos ;
$_747 = 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 07:37:57 +02:00
else { $_747 = FALSE ; break ; }
$res_746 = $result ;
$pos_746 = $this -> pos ;
$_745 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if (( $subres = $this -> rx ( '/[A-Za-z_]/' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_745 = FALSE ; break ; }
$_745 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_745 === TRUE ) {
$result = $res_746 ;
$this -> pos = $pos_746 ;
$_747 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 07:37:57 +02:00
if ( $_745 === FALSE ) {
$result = $res_746 ;
$this -> pos = $pos_746 ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 07:37:57 +02:00
$_747 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_747 === TRUE ) { $_762 = TRUE ; break ; }
$result = $res_742 ;
$this -> pos = $pos_742 ;
$_760 = NULL ;
2011-03-17 01:08:13 +01:00
do {
2012-04-16 07:37:57 +02:00
$res_749 = $result ;
$pos_749 = $this -> pos ;
$_752 = 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 07:37:57 +02:00
else { $_752 = FALSE ; break ; }
$res_751 = $result ;
$pos_751 = $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 07:37:57 +02:00
$result = $res_751 ;
$this -> pos = $pos_751 ;
$_752 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
else {
2012-04-16 07:37:57 +02:00
$result = $res_751 ;
$this -> pos = $pos_751 ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 07:37:57 +02:00
$_752 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_752 === TRUE ) { $_760 = TRUE ; break ; }
$result = $res_749 ;
$this -> pos = $pos_749 ;
$_758 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if (( $subres = $this -> literal ( '{$' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_758 = FALSE ; break ; }
$res_757 = $result ;
$pos_757 = $this -> pos ;
$_756 = NULL ;
2011-03-17 01:08:13 +01:00
do {
if (( $subres = $this -> rx ( '/[A-Za-z_]/' ) ) !== FALSE ) { $result [ " text " ] .= $subres ; }
2012-04-16 07:37:57 +02:00
else { $_756 = FALSE ; break ; }
$_756 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_756 === TRUE ) {
$result = $res_757 ;
$this -> pos = $pos_757 ;
$_758 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 07:37:57 +02:00
if ( $_756 === FALSE ) {
$result = $res_757 ;
$this -> pos = $pos_757 ;
2011-03-17 01:08:13 +01:00
}
2012-04-16 07:37:57 +02:00
$_758 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_758 === TRUE ) { $_760 = TRUE ; break ; }
$result = $res_749 ;
$this -> pos = $pos_749 ;
$_760 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_760 === TRUE ) { $_762 = TRUE ; break ; }
$result = $res_742 ;
$this -> pos = $pos_742 ;
$_762 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_762 === TRUE ) { $_764 = TRUE ; break ; }
$result = $res_737 ;
$this -> pos = $pos_737 ;
$_764 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_764 === TRUE ) { $_766 = TRUE ; break ; }
$result = $res_735 ;
$this -> pos = $pos_735 ;
$_766 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_766 === TRUE ) { $_768 = TRUE ; break ; }
$result = $res_733 ;
$this -> pos = $pos_733 ;
$_768 = FALSE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_768 === FALSE ) { $_770 = FALSE ; break ; }
$_770 = TRUE ; break ;
2011-03-17 01:08:13 +01:00
}
while ( 0 );
2012-04-16 07:37:57 +02:00
if ( $_770 === FALSE ) {
$result = $res_771 ;
$this -> pos = $pos_771 ;
unset ( $res_771 );
unset ( $pos_771 );
2011-03-17 01:08:13 +01:00
break ;
}
$count += 1 ;
2011-02-28 04:12:41 +01:00
}
2011-03-17 01:08:13 +01:00
if ( $count > 0 ) { return $this -> finalise ( $result ); }
2011-02-28 04:12:41 +01:00
else { return FALSE ; }
}
2011-02-14 22:03:42 +01:00
/**
2011-02-28 04:12:41 +01:00
* We convert text
2011-02-14 22:03:42 +01:00
*/
2012-09-19 12:07:39 +02:00
public function Text__finalise ( & $res ) {
2011-02-28 04:12:41 +01:00
$text = $res [ 'text' ];
2011-03-17 01:08:13 +01:00
// Unescape any escaped characters in the text, then put back escapes for any single quotes and backslashes
$text = stripslashes ( $text );
$text = addcslashes ( $text , '\'\\' );
// 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
*/
2012-09-19 12:07:39 +02:00
public 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
*/
2012-09-19 12:07:39 +02:00
public 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
}
}