ENHANCEMENT: Add back in partial caching

This commit is contained in:
Hamish Friedlander 2011-02-28 16:12:41 +13:00
parent fdf81c80cb
commit 29c06edd23
3 changed files with 2669 additions and 1531 deletions

View File

@ -67,89 +67,315 @@ class SSTemplateParser extends Parser {
*/
protected $includeDebuggingComments = false;
/**
* Override the function that constructs the result arrays to also prepare a 'php' item in the array
*/
function construct($matchrule, $name, $arguments = null) {
$res = parent::construct($matchrule, $name, $arguments);
if (!isset($res['php'])) $res['php'] = '';
return $res;
}
/* Template: (Comment | If | Require | CacheBlock | UncachedBlock | OldI18NTag | ClosedBlock | OpenBlock | MalformedBlock | Injection | Text)+ */
protected $match_Template_typestack = array('Template');
function match_Template ($stack = array()) {
$matchrule = "Template"; $result = $this->construct($matchrule, $matchrule, null);
$count = 0;
while (true) {
$res_42 = $result;
$pos_42 = $this->pos;
$_41 = NULL;
do {
$_39 = NULL;
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 );
$_39 = TRUE; break;
}
$result = $res_0;
$this->pos = $pos_0;
$_37 = NULL;
do {
$res_2 = $result;
$pos_2 = $this->pos;
$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_37 = TRUE; break;
}
$result = $res_2;
$this->pos = $pos_2;
$_35 = NULL;
do {
$res_4 = $result;
$pos_4 = $this->pos;
$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_35 = TRUE; break;
}
$result = $res_4;
$this->pos = $pos_4;
$_33 = NULL;
do {
$res_6 = $result;
$pos_6 = $this->pos;
$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_33 = TRUE; break;
}
$result = $res_6;
$this->pos = $pos_6;
$_31 = NULL;
do {
$res_8 = $result;
$pos_8 = $this->pos;
$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_31 = TRUE; break;
}
$result = $res_8;
$this->pos = $pos_8;
$_29 = NULL;
do {
$res_10 = $result;
$pos_10 = $this->pos;
$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_29 = TRUE; break;
}
$result = $res_10;
$this->pos = $pos_10;
$_27 = NULL;
do {
$res_12 = $result;
$pos_12 = $this->pos;
$matcher = 'match_'.'ClosedBlock'; $key = $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 );
$_27 = TRUE; break;
}
$result = $res_12;
$this->pos = $pos_12;
$_25 = NULL;
do {
$res_14 = $result;
$pos_14 = $this->pos;
$matcher = 'match_'.'OpenBlock'; $key = $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_14;
$this->pos = $pos_14;
$_23 = NULL;
do {
$res_16 = $result;
$pos_16 = $this->pos;
$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_23 = TRUE; break;
}
$result = $res_16;
$this->pos = $pos_16;
$_21 = NULL;
do {
$res_18 = $result;
$pos_18 = $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 );
$_21 = TRUE; break;
}
$result = $res_18;
$this->pos = $pos_18;
$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 );
$_21 = TRUE; break;
}
$result = $res_18;
$this->pos = $pos_18;
$_21 = FALSE; break;
}
while(0);
if( $_21 === TRUE ) { $_23 = TRUE; break; }
$result = $res_16;
$this->pos = $pos_16;
$_23 = FALSE; break;
}
while(0);
if( $_23 === TRUE ) { $_25 = TRUE; break; }
$result = $res_14;
$this->pos = $pos_14;
$_25 = FALSE; break;
}
while(0);
if( $_25 === TRUE ) { $_27 = TRUE; break; }
$result = $res_12;
$this->pos = $pos_12;
$_27 = FALSE; break;
}
while(0);
if( $_27 === TRUE ) { $_29 = TRUE; break; }
$result = $res_10;
$this->pos = $pos_10;
$_29 = FALSE; break;
}
while(0);
if( $_29 === TRUE ) { $_31 = TRUE; break; }
$result = $res_8;
$this->pos = $pos_8;
$_31 = FALSE; break;
}
while(0);
if( $_31 === TRUE ) { $_33 = TRUE; break; }
$result = $res_6;
$this->pos = $pos_6;
$_33 = FALSE; break;
}
while(0);
if( $_33 === TRUE ) { $_35 = TRUE; break; }
$result = $res_4;
$this->pos = $pos_4;
$_35 = FALSE; break;
}
while(0);
if( $_35 === TRUE ) { $_37 = TRUE; break; }
$result = $res_2;
$this->pos = $pos_2;
$_37 = FALSE; break;
}
while(0);
if( $_37 === TRUE ) { $_39 = TRUE; break; }
$result = $res_0;
$this->pos = $pos_0;
$_39 = FALSE; break;
}
while(0);
if( $_39 === FALSE) { $_41 = FALSE; break; }
$_41 = TRUE; break;
}
while(0);
if( $_41 === FALSE) {
$result = $res_42;
$this->pos = $pos_42;
unset( $res_42 );
unset( $pos_42 );
break;
}
$count += 1;
}
if ($count > 0) { return $this->finalise($result); }
else { return FALSE; }
}
function Template_STR(&$res, $sub) {
$res['php'] .= $sub['php'] . PHP_EOL ;
}
/* Word: / [A-Za-z_] [A-Za-z0-9_]* / */
function match_Word ($substack = array()) {
$result = array("name"=>"Word", "text"=>"");
$_0 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->rx( $_0->expand('/ [A-Za-z_] [A-Za-z0-9_]* /') ) ) !== FALSE) {
protected $match_Word_typestack = array('Word');
function match_Word ($stack = array()) {
$matchrule = "Word"; $result = $this->construct($matchrule, $matchrule, null);
if (( $subres = $this->rx( '/ [A-Za-z_] [A-Za-z0-9_]* /' ) ) !== FALSE) {
$result["text"] .= $subres;
return $result;
return $this->finalise($result);
}
else { return FALSE; }
}
/* Number: / [0-9]+ / */
function match_Number ($substack = array()) {
$result = array("name"=>"Number", "text"=>"");
$_2 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->rx( $_2->expand('/ [0-9]+ /') ) ) !== FALSE) {
protected $match_Number_typestack = array('Number');
function match_Number ($stack = array()) {
$matchrule = "Number"; $result = $this->construct($matchrule, $matchrule, null);
if (( $subres = $this->rx( '/ [0-9]+ /' ) ) !== FALSE) {
$result["text"] .= $subres;
return $result;
return $this->finalise($result);
}
else { return FALSE; }
}
/* Value: / [A-Za-z0-9_]+ / */
function match_Value ($substack = array()) {
$result = array("name"=>"Value", "text"=>"");
$_4 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->rx( $_4->expand('/ [A-Za-z0-9_]+ /') ) ) !== FALSE) {
protected $match_Value_typestack = array('Value');
function match_Value ($stack = array()) {
$matchrule = "Value"; $result = $this->construct($matchrule, $matchrule, null);
if (( $subres = $this->rx( '/ [A-Za-z0-9_]+ /' ) ) !== FALSE) {
$result["text"] .= $subres;
return $result;
return $this->finalise($result);
}
else { return FALSE; }
}
/* CallArguments: :Argument ( < "," < :Argument )* */
function match_CallArguments ($substack = array()) {
$result = $this->construct( "CallArguments" );
$_13 = NULL;
protected $match_CallArguments_typestack = array('CallArguments');
function match_CallArguments ($stack = array()) {
$matchrule = "CallArguments"; $result = $this->construct($matchrule, $matchrule, null);
$_53 = NULL;
do {
$key = "Argument"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) );
$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, "Argument" );
}
else { $_13 = FALSE; break; }
else { $_53 = FALSE; break; }
while (true) {
$res_12 = $result;
$pos_12 = $this->pos;
$_11 = NULL;
$res_52 = $result;
$pos_52 = $this->pos;
$_51 = NULL;
do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == ",") {
if (substr($this->string,$this->pos,1) == ',') {
$this->pos += 1;
$result["text"] .= ",";
$result["text"] .= ',';
}
else { $_11 = FALSE; break; }
else { $_51 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "Argument"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) );
$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, "Argument" );
}
else { $_11 = FALSE; break; }
$_11 = TRUE; break;
else { $_51 = FALSE; break; }
$_51 = TRUE; break;
}
while(0);
if( $_11 === FALSE) {
$result = $res_12;
$this->pos = $pos_12;
unset( $res_12 );
unset( $pos_12 );
if( $_51 === FALSE) {
$result = $res_52;
$this->pos = $pos_52;
unset( $res_52 );
unset( $pos_52 );
break;
}
}
$_13 = TRUE; break;
$_53 = TRUE; break;
}
while(0);
if( $_13 === TRUE ) {
return $this->finalise( "CallArguments", $result );
}
if( $_13 === FALSE) { return FALSE; }
if( $_53 === TRUE ) { return $this->finalise($result); }
if( $_53 === FALSE) { return FALSE; }
}
@ -160,188 +386,185 @@ class SSTemplateParser extends Parser {
* to numbers when needed.
*/
function CallArguments_Argument(&$res, $sub) {
if (isset($res['php'])) $res['php'] .= ', ';
else $res['php'] = '';
if (!empty($res['php'])) $res['php'] .= ', ';
$res['php'] .= ($sub['ArgumentMode'] == 'default') ? $sub['string_php'] : str_replace('$$FINAL', 'XML_val', $sub['php']);
}
/* Call: Method:Word ( "(" < :CallArguments? > ")" )? */
function match_Call ($substack = array()) {
$result = $this->construct( "Call" );
$_23 = NULL;
protected $match_Call_typestack = array('Call');
function match_Call ($stack = array()) {
$matchrule = "Call"; $result = $this->construct($matchrule, $matchrule, null);
$_63 = NULL;
do {
$key = "Word"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) );
$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" );
}
else { $_23 = FALSE; break; }
$res_22 = $result;
$pos_22 = $this->pos;
$_21 = NULL;
else { $_63 = FALSE; break; }
$res_62 = $result;
$pos_62 = $this->pos;
$_61 = NULL;
do {
if (substr($this->string,$this->pos,1) == "(") {
if (substr($this->string,$this->pos,1) == '(') {
$this->pos += 1;
$result["text"] .= "(";
$result["text"] .= '(';
}
else { $_21 = FALSE; break; }
else { $_61 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$res_18 = $result;
$pos_18 = $this->pos;
$key = "CallArguments"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_CallArguments(array_merge($substack, array($result))) ) );
$res_58 = $result;
$pos_58 = $this->pos;
$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" );
}
else {
$result = $res_18;
$this->pos = $pos_18;
unset( $res_18 );
unset( $pos_18 );
$result = $res_58;
$this->pos = $pos_58;
unset( $res_58 );
unset( $pos_58 );
}
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == ")") {
if (substr($this->string,$this->pos,1) == ')') {
$this->pos += 1;
$result["text"] .= ")";
$result["text"] .= ')';
}
else { $_21 = FALSE; break; }
$_21 = TRUE; break;
else { $_61 = FALSE; break; }
$_61 = TRUE; break;
}
while(0);
if( $_21 === FALSE) {
$result = $res_22;
$this->pos = $pos_22;
unset( $res_22 );
unset( $pos_22 );
if( $_61 === FALSE) {
$result = $res_62;
$this->pos = $pos_62;
unset( $res_62 );
unset( $pos_62 );
}
$_23 = TRUE; break;
$_63 = TRUE; break;
}
while(0);
if( $_23 === TRUE ) {
return $this->finalise( "Call", $result );
}
if( $_23 === FALSE) { return FALSE; }
if( $_63 === TRUE ) { return $this->finalise($result); }
if( $_63 === FALSE) { return FALSE; }
}
/* LookupStep: :Call &"." */
function match_LookupStep ($substack = array()) {
$result = $this->construct( "LookupStep" );
$_27 = NULL;
protected $match_LookupStep_typestack = array('LookupStep');
function match_LookupStep ($stack = array()) {
$matchrule = "LookupStep"; $result = $this->construct($matchrule, $matchrule, null);
$_67 = NULL;
do {
$key = "Call"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Call(array_merge($substack, array($result))) ) );
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres, "Call" );
}
else { $_27 = FALSE; break; }
$res_26 = $result;
$pos_26 = $this->pos;
if (substr($this->string,$this->pos,1) == ".") {
else { $_67 = FALSE; break; }
$res_66 = $result;
$pos_66 = $this->pos;
if (substr($this->string,$this->pos,1) == '.') {
$this->pos += 1;
$result["text"] .= ".";
$result = $res_26;
$this->pos = $pos_26;
$result["text"] .= '.';
$result = $res_66;
$this->pos = $pos_66;
}
else {
$result = $res_26;
$this->pos = $pos_26;
$_27 = FALSE; break;
$result = $res_66;
$this->pos = $pos_66;
$_67 = FALSE; break;
}
$_27 = TRUE; break;
$_67 = TRUE; break;
}
while(0);
if( $_27 === TRUE ) {
return $this->finalise( "LookupStep", $result );
}
if( $_27 === FALSE) { return FALSE; }
if( $_67 === TRUE ) { return $this->finalise($result); }
if( $_67 === FALSE) { return FALSE; }
}
/* LastLookupStep: :Call */
function match_LastLookupStep ($substack = array()) {
$result = $this->construct( "LastLookupStep" );
$key = "Call"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Call(array_merge($substack, array($result))) ) );
protected $match_LastLookupStep_typestack = array('LastLookupStep');
function match_LastLookupStep ($stack = array()) {
$matchrule = "LastLookupStep"; $result = $this->construct($matchrule, $matchrule, null);
$matcher = 'match_'.'Call'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres, "Call" );
return $this->finalise( "LastLookupStep", $result );
return $this->finalise($result);
}
else { return FALSE; }
}
/* Lookup: LookupStep ("." LookupStep)* "." LastLookupStep | LastLookupStep */
function match_Lookup ($substack = array()) {
$result = $this->construct( "Lookup" );
$_41 = NULL;
protected $match_Lookup_typestack = array('Lookup');
function match_Lookup ($stack = array()) {
$matchrule = "Lookup"; $result = $this->construct($matchrule, $matchrule, null);
$_81 = NULL;
do {
$res_30 = $result;
$pos_30 = $this->pos;
$_38 = NULL;
$res_70 = $result;
$pos_70 = $this->pos;
$_78 = NULL;
do {
$key = "LookupStep"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_LookupStep(array_merge($substack, array($result))) ) );
$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))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_38 = FALSE; break; }
else { $_78 = FALSE; break; }
while (true) {
$res_35 = $result;
$pos_35 = $this->pos;
$_34 = NULL;
$res_75 = $result;
$pos_75 = $this->pos;
$_74 = NULL;
do {
if (substr($this->string,$this->pos,1) == ".") {
if (substr($this->string,$this->pos,1) == '.') {
$this->pos += 1;
$result["text"] .= ".";
$result["text"] .= '.';
}
else { $_34 = FALSE; break; }
$key = "LookupStep"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_LookupStep(array_merge($substack, array($result))) ) );
else { $_74 = FALSE; break; }
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
}
else { $_34 = FALSE; break; }
$_34 = TRUE; break;
else { $_74 = FALSE; break; }
$_74 = TRUE; break;
}
while(0);
if( $_34 === FALSE) {
$result = $res_35;
$this->pos = $pos_35;
unset( $res_35 );
unset( $pos_35 );
if( $_74 === FALSE) {
$result = $res_75;
$this->pos = $pos_75;
unset( $res_75 );
unset( $pos_75 );
break;
}
}
if (substr($this->string,$this->pos,1) == ".") {
if (substr($this->string,$this->pos,1) == '.') {
$this->pos += 1;
$result["text"] .= ".";
$result["text"] .= '.';
}
else { $_38 = FALSE; break; }
$key = "LastLookupStep"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_LastLookupStep(array_merge($substack, array($result))) ) );
else { $_78 = FALSE; break; }
$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))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_38 = FALSE; break; }
$_38 = TRUE; break;
else { $_78 = FALSE; break; }
$_78 = TRUE; break;
}
while(0);
if( $_38 === TRUE ) { $_41 = TRUE; break; }
$result = $res_30;
$this->pos = $pos_30;
$key = "LastLookupStep"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_LastLookupStep(array_merge($substack, array($result))) ) );
if( $_78 === TRUE ) { $_81 = TRUE; break; }
$result = $res_70;
$this->pos = $pos_70;
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_41 = TRUE; break;
$_81 = TRUE; break;
}
$result = $res_30;
$this->pos = $pos_30;
$_41 = FALSE; break;
$result = $res_70;
$this->pos = $pos_70;
$_81 = FALSE; break;
}
while(0);
if( $_41 === TRUE ) {
return $this->finalise( "Lookup", $result );
}
if( $_41 === FALSE) { return FALSE; }
if( $_81 === TRUE ) { return $this->finalise($result); }
if( $_81 === FALSE) { return FALSE; }
}
@ -379,90 +602,86 @@ class SSTemplateParser extends Parser {
}
/* SimpleInjection: '$' :Lookup */
function match_SimpleInjection ($substack = array()) {
$result = $this->construct( "SimpleInjection" );
$_45 = NULL;
protected $match_SimpleInjection_typestack = array('SimpleInjection');
function match_SimpleInjection ($stack = array()) {
$matchrule = "SimpleInjection"; $result = $this->construct($matchrule, $matchrule, null);
$_85 = NULL;
do {
if (substr($this->string,$this->pos,1) == '$') {
$this->pos += 1;
$result["text"] .= '$';
}
else { $_45 = FALSE; break; }
$key = "Lookup"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Lookup(array_merge($substack, array($result))) ) );
else { $_85 = FALSE; break; }
$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" );
}
else { $_45 = FALSE; break; }
$_45 = TRUE; break;
else { $_85 = FALSE; break; }
$_85 = TRUE; break;
}
while(0);
if( $_45 === TRUE ) {
return $this->finalise( "SimpleInjection", $result );
}
if( $_45 === FALSE) { return FALSE; }
if( $_85 === TRUE ) { return $this->finalise($result); }
if( $_85 === FALSE) { return FALSE; }
}
/* BracketInjection: '{$' :Lookup "}" */
function match_BracketInjection ($substack = array()) {
$result = $this->construct( "BracketInjection" );
$_51 = NULL;
protected $match_BracketInjection_typestack = array('BracketInjection');
function match_BracketInjection ($stack = array()) {
$matchrule = "BracketInjection"; $result = $this->construct($matchrule, $matchrule, null);
$_90 = NULL;
do {
$_47 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_47->expand('{$') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_51 = FALSE; break; }
$key = "Lookup"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Lookup(array_merge($substack, array($result))) ) );
if (( $subres = $this->literal( '{$' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_90 = FALSE; break; }
$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" );
}
else { $_51 = FALSE; break; }
if (substr($this->string,$this->pos,1) == "}") {
else { $_90 = FALSE; break; }
if (substr($this->string,$this->pos,1) == '}') {
$this->pos += 1;
$result["text"] .= "}";
$result["text"] .= '}';
}
else { $_51 = FALSE; break; }
$_51 = TRUE; break;
else { $_90 = FALSE; break; }
$_90 = TRUE; break;
}
while(0);
if( $_51 === TRUE ) {
return $this->finalise( "BracketInjection", $result );
}
if( $_51 === FALSE) { return FALSE; }
if( $_90 === TRUE ) { return $this->finalise($result); }
if( $_90 === FALSE) { return FALSE; }
}
/* Injection: BracketInjection | SimpleInjection */
function match_Injection ($substack = array()) {
$result = $this->construct( "Injection" );
$_56 = NULL;
protected $match_Injection_typestack = array('Injection');
function match_Injection ($stack = array()) {
$matchrule = "Injection"; $result = $this->construct($matchrule, $matchrule, null);
$_95 = NULL;
do {
$res_53 = $result;
$pos_53 = $this->pos;
$key = "BracketInjection"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_BracketInjection(array_merge($substack, array($result))) ) );
$res_92 = $result;
$pos_92 = $this->pos;
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_56 = TRUE; break;
$_95 = TRUE; break;
}
$result = $res_53;
$this->pos = $pos_53;
$key = "SimpleInjection"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_SimpleInjection(array_merge($substack, array($result))) ) );
$result = $res_92;
$this->pos = $pos_92;
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_56 = TRUE; break;
$_95 = TRUE; break;
}
$result = $res_53;
$this->pos = $pos_53;
$_56 = FALSE; break;
$result = $res_92;
$this->pos = $pos_92;
$_95 = FALSE; break;
}
while(0);
if( $_56 === TRUE ) {
return $this->finalise( "Injection", $result );
}
if( $_56 === FALSE) { return FALSE; }
if( $_95 === TRUE ) { return $this->finalise($result); }
if( $_95 === FALSE) { return FALSE; }
}
@ -472,13 +691,14 @@ class SSTemplateParser extends Parser {
}
/* DollarMarkedLookup: SimpleInjection */
function match_DollarMarkedLookup ($substack = array()) {
$result = $this->construct( "DollarMarkedLookup" );
$key = "SimpleInjection"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_SimpleInjection(array_merge($substack, array($result))) ) );
protected $match_DollarMarkedLookup_typestack = array('DollarMarkedLookup');
function match_DollarMarkedLookup ($stack = array()) {
$matchrule = "DollarMarkedLookup"; $result = $this->construct($matchrule, $matchrule, null);
$matcher = 'match_'.'SimpleInjection'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
return $this->finalise( "DollarMarkedLookup", $result );
return $this->finalise($result);
}
else { return FALSE; }
}
@ -490,160 +710,151 @@ class SSTemplateParser extends Parser {
}
/* QuotedString: q:/['"]/ String:/ (\\\\ | \\. | [^$q\\])* / '$q' */
function match_QuotedString ($substack = array()) {
$result = $this->construct( "QuotedString" );
$_67 = NULL;
protected $match_QuotedString_typestack = array('QuotedString');
function match_QuotedString ($stack = array()) {
$matchrule = "QuotedString"; $result = $this->construct($matchrule, $matchrule, null);
$_101 = NULL;
do {
$substack[] = $result;
$result = $this->construct( "q" );
$_59 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->rx( $_59->expand('/[\'"]/') ) ) !== FALSE) {
$stack[] = $result; $result = $this->construct( $matchrule, "q" );
if (( $subres = $this->rx( '/[\'"]/' ) ) !== FALSE) {
$result["text"] .= $subres;
$subres = $result ;
$result = array_pop( $substack ) ;
$subres = $result; $result = array_pop($stack);
$this->store( $result, $subres, 'q' );
}
else {
$result = array_pop( $substack ) ;
$_67 = FALSE; break;
$result = array_pop($stack);
$_101 = FALSE; break;
}
$substack[] = $result;
$result = $this->construct( "String" );
$_62 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->rx( $_62->expand('/ (\\\\\\\\ | \\\\. | [^$q\\\\])* /') ) ) !== FALSE) {
$stack[] = $result; $result = $this->construct( $matchrule, "String" );
if (( $subres = $this->rx( '/ (\\\\\\\\ | \\\\. | [^'.$this->expression($result, $stack, 'q').'\\\\])* /' ) ) !== FALSE) {
$result["text"] .= $subres;
$subres = $result ;
$result = array_pop( $substack ) ;
$subres = $result; $result = array_pop($stack);
$this->store( $result, $subres, 'String' );
}
else {
$result = array_pop( $substack ) ;
$_67 = FALSE; break;
$result = array_pop($stack);
$_101 = FALSE; break;
}
$_65 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_65->expand('$q') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_67 = FALSE; break; }
$_67 = TRUE; break;
if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'q').'' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_101 = FALSE; break; }
$_101 = TRUE; break;
}
while(0);
if( $_67 === TRUE ) {
return $this->finalise( "QuotedString", $result );
}
if( $_67 === FALSE) { return FALSE; }
if( $_101 === TRUE ) { return $this->finalise($result); }
if( $_101 === FALSE) { return FALSE; }
}
/* FreeString: /[^,)%!=|&]+/ */
function match_FreeString ($substack = array()) {
$result = array("name"=>"FreeString", "text"=>"");
$_69 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->rx( $_69->expand('/[^,)%!=|&]+/') ) ) !== FALSE) {
protected $match_FreeString_typestack = array('FreeString');
function match_FreeString ($stack = array()) {
$matchrule = "FreeString"; $result = $this->construct($matchrule, $matchrule, null);
if (( $subres = $this->rx( '/[^,)%!=|&]+/' ) ) !== FALSE) {
$result["text"] .= $subres;
return $result;
return $this->finalise($result);
}
else { return FALSE; }
}
/* Argument:
:DollarMarkedLookup |
:QuotedString |
:Lookup !(< FreeString)|
:FreeString */
function match_Argument ($substack = array()) {
$result = $this->construct( "Argument" );
$_88 = NULL;
:DollarMarkedLookup |
:QuotedString |
:Lookup !(< FreeString)|
:FreeString */
protected $match_Argument_typestack = array('Argument');
function match_Argument ($stack = array()) {
$matchrule = "Argument"; $result = $this->construct($matchrule, $matchrule, null);
$_121 = NULL;
do {
$res_71 = $result;
$pos_71 = $this->pos;
$key = "DollarMarkedLookup"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_DollarMarkedLookup(array_merge($substack, array($result))) ) );
$res_104 = $result;
$pos_104 = $this->pos;
$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" );
$_88 = TRUE; break;
$_121 = TRUE; break;
}
$result = $res_71;
$this->pos = $pos_71;
$_86 = NULL;
$result = $res_104;
$this->pos = $pos_104;
$_119 = NULL;
do {
$res_73 = $result;
$pos_73 = $this->pos;
$key = "QuotedString"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_QuotedString(array_merge($substack, array($result))) ) );
$res_106 = $result;
$pos_106 = $this->pos;
$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" );
$_86 = TRUE; break;
$_119 = TRUE; break;
}
$result = $res_73;
$this->pos = $pos_73;
$_84 = NULL;
$result = $res_106;
$this->pos = $pos_106;
$_117 = NULL;
do {
$res_75 = $result;
$pos_75 = $this->pos;
$_81 = NULL;
$res_108 = $result;
$pos_108 = $this->pos;
$_114 = NULL;
do {
$key = "Lookup"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Lookup(array_merge($substack, array($result))) ) );
$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" );
}
else { $_81 = FALSE; break; }
$res_80 = $result;
$pos_80 = $this->pos;
$_79 = NULL;
else { $_114 = FALSE; break; }
$res_113 = $result;
$pos_113 = $this->pos;
$_112 = NULL;
do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "FreeString"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_FreeString(array_merge($substack, array($result))) ) );
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
}
else { $_79 = FALSE; break; }
$_79 = TRUE; break;
else { $_112 = FALSE; break; }
$_112 = TRUE; break;
}
while(0);
if( $_79 === TRUE ) {
$result = $res_80;
$this->pos = $pos_80;
$_81 = FALSE; break;
if( $_112 === TRUE ) {
$result = $res_113;
$this->pos = $pos_113;
$_114 = FALSE; break;
}
if( $_79 === FALSE) {
$result = $res_80;
$this->pos = $pos_80;
if( $_112 === FALSE) {
$result = $res_113;
$this->pos = $pos_113;
}
$_81 = TRUE; break;
$_114 = TRUE; break;
}
while(0);
if( $_81 === TRUE ) { $_84 = TRUE; break; }
$result = $res_75;
$this->pos = $pos_75;
$key = "FreeString"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_FreeString(array_merge($substack, array($result))) ) );
if( $_114 === TRUE ) { $_117 = TRUE; break; }
$result = $res_108;
$this->pos = $pos_108;
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres, "FreeString" );
$_84 = TRUE; break;
$_117 = TRUE; break;
}
$result = $res_75;
$this->pos = $pos_75;
$_84 = FALSE; break;
$result = $res_108;
$this->pos = $pos_108;
$_117 = FALSE; break;
}
while(0);
if( $_84 === TRUE ) { $_86 = TRUE; break; }
$result = $res_73;
$this->pos = $pos_73;
$_86 = FALSE; break;
if( $_117 === TRUE ) { $_119 = TRUE; break; }
$result = $res_106;
$this->pos = $pos_106;
$_119 = FALSE; break;
}
while(0);
if( $_86 === TRUE ) { $_88 = TRUE; break; }
$result = $res_71;
$this->pos = $pos_71;
$_88 = FALSE; break;
if( $_119 === TRUE ) { $_121 = TRUE; break; }
$result = $res_104;
$this->pos = $pos_104;
$_121 = FALSE; break;
}
while(0);
if( $_88 === TRUE ) {
return $this->finalise( "Argument", $result );
}
if( $_88 === FALSE) { return FALSE; }
if( $_121 === TRUE ) { return $this->finalise($result); }
if( $_121 === FALSE) { return FALSE; }
}
@ -691,90 +902,85 @@ class SSTemplateParser extends Parser {
}
/* ComparisonOperator: "==" | "!=" | "=" */
function match_ComparisonOperator ($substack = array()) {
$result = $this->construct( "ComparisonOperator" );
$_99 = NULL;
protected $match_ComparisonOperator_typestack = array('ComparisonOperator');
function match_ComparisonOperator ($stack = array()) {
$matchrule = "ComparisonOperator"; $result = $this->construct($matchrule, $matchrule, null);
$_130 = NULL;
do {
$res_90 = $result;
$pos_90 = $this->pos;
$_91 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_91->expand("==") ) ) !== FALSE) {
$res_123 = $result;
$pos_123 = $this->pos;
if (( $subres = $this->literal( '==' ) ) !== FALSE) {
$result["text"] .= $subres;
$_99 = TRUE; break;
$_130 = TRUE; break;
}
$result = $res_90;
$this->pos = $pos_90;
$_97 = NULL;
$result = $res_123;
$this->pos = $pos_123;
$_128 = NULL;
do {
$res_93 = $result;
$pos_93 = $this->pos;
$_94 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_94->expand("!=") ) ) !== FALSE) {
$res_125 = $result;
$pos_125 = $this->pos;
if (( $subres = $this->literal( '!=' ) ) !== FALSE) {
$result["text"] .= $subres;
$_97 = TRUE; break;
$_128 = TRUE; break;
}
$result = $res_93;
$this->pos = $pos_93;
if (substr($this->string,$this->pos,1) == "=") {
$result = $res_125;
$this->pos = $pos_125;
if (substr($this->string,$this->pos,1) == '=') {
$this->pos += 1;
$result["text"] .= "=";
$_97 = TRUE; break;
$result["text"] .= '=';
$_128 = TRUE; break;
}
$result = $res_93;
$this->pos = $pos_93;
$_97 = FALSE; break;
$result = $res_125;
$this->pos = $pos_125;
$_128 = FALSE; break;
}
while(0);
if( $_97 === TRUE ) { $_99 = TRUE; break; }
$result = $res_90;
$this->pos = $pos_90;
$_99 = FALSE; break;
if( $_128 === TRUE ) { $_130 = TRUE; break; }
$result = $res_123;
$this->pos = $pos_123;
$_130 = FALSE; break;
}
while(0);
if( $_99 === TRUE ) {
return $this->finalise( "ComparisonOperator", $result );
}
if( $_99 === FALSE) { return FALSE; }
if( $_130 === TRUE ) { return $this->finalise($result); }
if( $_130 === FALSE) { return FALSE; }
}
/* Comparison: Argument < ComparisonOperator > Argument */
function match_Comparison ($substack = array()) {
$result = $this->construct( "Comparison" );
$_106 = NULL;
protected $match_Comparison_typestack = array('Comparison');
function match_Comparison ($stack = array()) {
$matchrule = "Comparison"; $result = $this->construct($matchrule, $matchrule, null);
$_137 = NULL;
do {
$key = "Argument"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) );
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_106 = FALSE; break; }
else { $_137 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "ComparisonOperator"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_ComparisonOperator(array_merge($substack, array($result))) ) );
$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))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_106 = FALSE; break; }
else { $_137 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "Argument"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) );
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_106 = FALSE; break; }
$_106 = TRUE; break;
else { $_137 = FALSE; break; }
$_137 = TRUE; break;
}
while(0);
if( $_106 === TRUE ) {
return $this->finalise( "Comparison", $result );
}
if( $_106 === FALSE) { return FALSE; }
if( $_137 === TRUE ) { return $this->finalise($result); }
if( $_137 === FALSE) { return FALSE; }
}
function Comparison_Argument(&$res, $sub) {
if ($sub['ArgumentMode'] == 'default') {
if (isset($res['php'])) $res['php'] .= $sub['string_php'];
if (!empty($res['php'])) $res['php'] .= $sub['string_php'];
else $res['php'] = str_replace('$$FINAL', 'XML_val', $sub['lookup_php']);
}
else {
if (!isset($res['php'])) $res['php'] = '';
$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']);
}
}
@ -784,56 +990,48 @@ class SSTemplateParser extends Parser {
}
/* PresenceCheck: (Not:'not' <)? Argument */
function match_PresenceCheck ($substack = array()) {
$result = $this->construct( "PresenceCheck" );
$_115 = NULL;
protected $match_PresenceCheck_typestack = array('PresenceCheck');
function match_PresenceCheck ($stack = array()) {
$matchrule = "PresenceCheck"; $result = $this->construct($matchrule, $matchrule, null);
$_144 = NULL;
do {
$res_113 = $result;
$pos_113 = $this->pos;
$_112 = NULL;
$res_142 = $result;
$pos_142 = $this->pos;
$_141 = NULL;
do {
$substack[] = $result;
$result = $this->construct( "Not" );
$_108 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_108->expand('not') ) ) !== FALSE) {
$stack[] = $result; $result = $this->construct( $matchrule, "Not" );
if (( $subres = $this->literal( 'not' ) ) !== FALSE) {
$result["text"] .= $subres;
$subres = $result ;
$result = array_pop( $substack ) ;
$subres = $result; $result = array_pop($stack);
$this->store( $result, $subres, 'Not' );
}
else {
$result = array_pop( $substack ) ;
$_112 = FALSE; break;
$result = array_pop($stack);
$_141 = FALSE; break;
}
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_112 = TRUE; break;
$_141 = TRUE; break;
}
while(0);
if( $_112 === FALSE) {
$result = $res_113;
$this->pos = $pos_113;
unset( $res_113 );
unset( $pos_113 );
if( $_141 === FALSE) {
$result = $res_142;
$this->pos = $pos_142;
unset( $res_142 );
unset( $pos_142 );
}
$key = "Argument"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) );
$matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_115 = FALSE; break; }
$_115 = TRUE; break;
else { $_144 = FALSE; break; }
$_144 = TRUE; break;
}
while(0);
if( $_115 === TRUE ) {
return $this->finalise( "PresenceCheck", $result );
}
if( $_115 === FALSE) { return FALSE; }
if( $_144 === TRUE ) { return $this->finalise($result); }
if( $_144 === FALSE) { return FALSE; }
}
function PresenceCheck__construct(&$res) {
$res['php'] = '';
}
function PresenceCheck_Not(&$res, $sub) {
$res['php'] = '!';
}
@ -851,35 +1049,34 @@ class SSTemplateParser extends Parser {
}
/* IfArgumentPortion: Comparison | PresenceCheck */
function match_IfArgumentPortion ($substack = array()) {
$result = $this->construct( "IfArgumentPortion" );
$_120 = NULL;
protected $match_IfArgumentPortion_typestack = array('IfArgumentPortion');
function match_IfArgumentPortion ($stack = array()) {
$matchrule = "IfArgumentPortion"; $result = $this->construct($matchrule, $matchrule, null);
$_149 = NULL;
do {
$res_117 = $result;
$pos_117 = $this->pos;
$key = "Comparison"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Comparison(array_merge($substack, array($result))) ) );
$res_146 = $result;
$pos_146 = $this->pos;
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_120 = TRUE; break;
$_149 = TRUE; break;
}
$result = $res_117;
$this->pos = $pos_117;
$key = "PresenceCheck"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_PresenceCheck(array_merge($substack, array($result))) ) );
$result = $res_146;
$this->pos = $pos_146;
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_120 = TRUE; break;
$_149 = TRUE; break;
}
$result = $res_117;
$this->pos = $pos_117;
$_120 = FALSE; break;
$result = $res_146;
$this->pos = $pos_146;
$_149 = FALSE; break;
}
while(0);
if( $_120 === TRUE ) {
return $this->finalise( "IfArgumentPortion", $result );
}
if( $_120 === FALSE) { return FALSE; }
if( $_149 === TRUE ) { return $this->finalise($result); }
if( $_149 === FALSE) { return FALSE; }
}
@ -889,91 +1086,84 @@ class SSTemplateParser extends Parser {
}
/* BooleanOperator: "||" | "&&" */
function match_BooleanOperator ($substack = array()) {
$result = $this->construct( "BooleanOperator" );
$_127 = NULL;
protected $match_BooleanOperator_typestack = array('BooleanOperator');
function match_BooleanOperator ($stack = array()) {
$matchrule = "BooleanOperator"; $result = $this->construct($matchrule, $matchrule, null);
$_154 = NULL;
do {
$res_122 = $result;
$pos_122 = $this->pos;
$_123 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_123->expand("||") ) ) !== FALSE) {
$res_151 = $result;
$pos_151 = $this->pos;
if (( $subres = $this->literal( '||' ) ) !== FALSE) {
$result["text"] .= $subres;
$_127 = TRUE; break;
$_154 = TRUE; break;
}
$result = $res_122;
$this->pos = $pos_122;
$_125 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_125->expand("&&") ) ) !== FALSE) {
$result = $res_151;
$this->pos = $pos_151;
if (( $subres = $this->literal( '&&' ) ) !== FALSE) {
$result["text"] .= $subres;
$_127 = TRUE; break;
$_154 = TRUE; break;
}
$result = $res_122;
$this->pos = $pos_122;
$_127 = FALSE; break;
$result = $res_151;
$this->pos = $pos_151;
$_154 = FALSE; break;
}
while(0);
if( $_127 === TRUE ) {
return $this->finalise( "BooleanOperator", $result );
}
if( $_127 === FALSE) { return FALSE; }
if( $_154 === TRUE ) { return $this->finalise($result); }
if( $_154 === FALSE) { return FALSE; }
}
/* IfArgument: :IfArgumentPortion ( < :BooleanOperator < :IfArgumentPortion )* */
function match_IfArgument ($substack = array()) {
$result = $this->construct( "IfArgument" );
$_136 = NULL;
protected $match_IfArgument_typestack = array('IfArgument');
function match_IfArgument ($stack = array()) {
$matchrule = "IfArgument"; $result = $this->construct($matchrule, $matchrule, null);
$_163 = NULL;
do {
$key = "IfArgumentPortion"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_IfArgumentPortion(array_merge($substack, array($result))) ) );
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres, "IfArgumentPortion" );
}
else { $_136 = FALSE; break; }
else { $_163 = FALSE; break; }
while (true) {
$res_135 = $result;
$pos_135 = $this->pos;
$_134 = NULL;
$res_162 = $result;
$pos_162 = $this->pos;
$_161 = NULL;
do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "BooleanOperator"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_BooleanOperator(array_merge($substack, array($result))) ) );
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres, "BooleanOperator" );
}
else { $_134 = FALSE; break; }
else { $_161 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "IfArgumentPortion"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_IfArgumentPortion(array_merge($substack, array($result))) ) );
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres, "IfArgumentPortion" );
}
else { $_134 = FALSE; break; }
$_134 = TRUE; break;
else { $_161 = FALSE; break; }
$_161 = TRUE; break;
}
while(0);
if( $_134 === FALSE) {
$result = $res_135;
$this->pos = $pos_135;
unset( $res_135 );
unset( $pos_135 );
if( $_161 === FALSE) {
$result = $res_162;
$this->pos = $pos_162;
unset( $res_162 );
unset( $pos_162 );
break;
}
}
$_136 = TRUE; break;
$_163 = TRUE; break;
}
while(0);
if( $_136 === TRUE ) {
return $this->finalise( "IfArgument", $result );
}
if( $_136 === FALSE) { return FALSE; }
if( $_163 === TRUE ) { return $this->finalise($result); }
if( $_163 === FALSE) { return FALSE; }
}
function IfArgument__construct(&$res){
$res['php'] = '';
}
function IfArgument_IfArgumentPortion(&$res, $sub) {
$res['php'] .= $sub['php'];
}
@ -982,177 +1172,161 @@ class SSTemplateParser extends Parser {
$res['php'] .= $sub['text'];
}
/* IfPart: '<%' < 'if' [ :IfArgument > '%>' :Template? */
function match_IfPart ($substack = array()) {
$result = $this->construct( "IfPart" );
$_149 = NULL;
/* IfPart: '<%' < 'if' [ :IfArgument > '%>' Template:$TemplateMatcher? */
protected $match_IfPart_typestack = array('IfPart');
function match_IfPart ($stack = array()) {
$matchrule = "IfPart"; $result = $this->construct($matchrule, $matchrule, null);
$_173 = NULL;
do {
$_138 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_138->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_149 = FALSE; break; }
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_173 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_141 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_141->expand('if') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_149 = FALSE; break; }
if (( $subres = $this->literal( 'if' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_173 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_149 = FALSE; break; }
$key = "IfArgument"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_IfArgument(array_merge($substack, array($result))) ) );
else { $_173 = FALSE; break; }
$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, "IfArgument" );
}
else { $_149 = FALSE; break; }
else { $_173 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_146 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_146->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_149 = FALSE; break; }
$res_148 = $result;
$pos_148 = $this->pos;
$key = "Template"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Template(array_merge($substack, array($result))) ) );
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_173 = FALSE; break; }
$res_172 = $result;
$pos_172 = $this->pos;
$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 {
$result = $res_148;
$this->pos = $pos_148;
unset( $res_148 );
unset( $pos_148 );
$result = $res_172;
$this->pos = $pos_172;
unset( $res_172 );
unset( $pos_172 );
}
$_149 = TRUE; break;
}
while(0);
if( $_149 === TRUE ) {
return $this->finalise( "IfPart", $result );
}
if( $_149 === FALSE) { return FALSE; }
}
/* ElseIfPart: '<%' < 'else_if' [ :IfArgument > '%>' :Template */
function match_ElseIfPart ($substack = array()) {
$result = $this->construct( "ElseIfPart" );
$_162 = NULL;
do {
$_151 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_151->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_162 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_154 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_154->expand('else_if') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_162 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_162 = FALSE; break; }
$key = "IfArgument"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_IfArgument(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres, "IfArgument" );
}
else { $_162 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_159 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_159->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_162 = FALSE; break; }
$key = "Template"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Template(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres, "Template" );
}
else { $_162 = FALSE; break; }
$_162 = TRUE; break;
}
while(0);
if( $_162 === TRUE ) {
return $this->finalise( "ElseIfPart", $result );
}
if( $_162 === FALSE) { return FALSE; }
}
/* ElsePart: '<%' < 'else' > '%>' :Template */
function match_ElsePart ($substack = array()) {
$result = $this->construct( "ElsePart" );
$_173 = NULL;
do {
$_164 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_164->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_173 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_167 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_167->expand('else') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_173 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_170 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_170->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_173 = FALSE; break; }
$key = "Template"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Template(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres, "Template" );
}
else { $_173 = FALSE; break; }
$_173 = TRUE; break;
}
while(0);
if( $_173 === TRUE ) {
return $this->finalise( "ElsePart", $result );
}
if( $_173 === TRUE ) { return $this->finalise($result); }
if( $_173 === FALSE) { return FALSE; }
}
/* If: IfPart ElseIfPart* ElsePart? '<%' < 'end_if' > '%>' */
function match_If ($substack = array()) {
$result = $this->construct( "If" );
$_186 = NULL;
/* ElseIfPart: '<%' < 'else_if' [ :IfArgument > '%>' Template:$TemplateMatcher */
protected $match_ElseIfPart_typestack = array('ElseIfPart');
function match_ElseIfPart ($stack = array()) {
$matchrule = "ElseIfPart"; $result = $this->construct($matchrule, $matchrule, null);
$_183 = NULL;
do {
$key = "IfPart"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_IfPart(array_merge($substack, array($result))) ) );
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_183 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( 'else_if' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_183 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_183 = FALSE; break; }
$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, "IfArgument" );
}
else { $_183 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_183 = FALSE; break; }
$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 { $_183 = FALSE; break; }
$_183 = TRUE; break;
}
while(0);
if( $_183 === TRUE ) { return $this->finalise($result); }
if( $_183 === FALSE) { return FALSE; }
}
/* ElsePart: '<%' < 'else' > '%>' Template:$TemplateMatcher */
protected $match_ElsePart_typestack = array('ElsePart');
function match_ElsePart ($stack = array()) {
$matchrule = "ElsePart"; $result = $this->construct($matchrule, $matchrule, null);
$_191 = NULL;
do {
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_191 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( 'else' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_191 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_191 = FALSE; break; }
$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 { $_191 = FALSE; break; }
$_191 = TRUE; break;
}
while(0);
if( $_191 === TRUE ) { return $this->finalise($result); }
if( $_191 === FALSE) { return FALSE; }
}
/* If: IfPart ElseIfPart* ElsePart? '<%' < 'end_if' > '%>' */
protected $match_If_typestack = array('If');
function match_If ($stack = array()) {
$matchrule = "If"; $result = $this->construct($matchrule, $matchrule, null);
$_201 = NULL;
do {
$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))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_186 = FALSE; break; }
else { $_201 = FALSE; break; }
while (true) {
$res_176 = $result;
$pos_176 = $this->pos;
$key = "ElseIfPart"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_ElseIfPart(array_merge($substack, array($result))) ) );
$res_194 = $result;
$pos_194 = $this->pos;
$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))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else {
$result = $res_176;
$this->pos = $pos_176;
unset( $res_176 );
unset( $pos_176 );
$result = $res_194;
$this->pos = $pos_194;
unset( $res_194 );
unset( $pos_194 );
break;
}
}
$res_177 = $result;
$pos_177 = $this->pos;
$key = "ElsePart"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_ElsePart(array_merge($substack, array($result))) ) );
$res_195 = $result;
$pos_195 = $this->pos;
$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))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else {
$result = $res_177;
$this->pos = $pos_177;
unset( $res_177 );
unset( $pos_177 );
$result = $res_195;
$this->pos = $pos_195;
unset( $res_195 );
unset( $pos_195 );
}
$_178 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_178->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_186 = FALSE; break; }
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_201 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_181 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_181->expand('end_if') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_186 = FALSE; break; }
if (( $subres = $this->literal( 'end_if' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_201 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_184 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_184->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_186 = FALSE; break; }
$_186 = TRUE; break;
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_201 = FALSE; break; }
$_201 = TRUE; break;
}
while(0);
if( $_186 === TRUE ) {
return $this->finalise( "If", $result );
}
if( $_186 === FALSE) { return FALSE; }
if( $_201 === TRUE ) { return $this->finalise($result); }
if( $_201 === FALSE) { return FALSE; }
}
@ -1179,70 +1353,64 @@ class SSTemplateParser extends Parser {
}
/* Require: '<%' < 'require' [ Call:(Method:Word "(" < :CallArguments > ")") > '%>' */
function match_Require ($substack = array()) {
$result = $this->construct( "Require" );
$_206 = NULL;
protected $match_Require_typestack = array('Require');
function match_Require ($stack = array()) {
$matchrule = "Require"; $result = $this->construct($matchrule, $matchrule, null);
$_217 = NULL;
do {
$_188 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_188->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_206 = FALSE; break; }
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_217 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_191 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_191->expand('require') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_206 = FALSE; break; }
if (( $subres = $this->literal( 'require' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_217 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_206 = FALSE; break; }
$substack[] = $result;
$result = $this->construct( "Call" );
$_200 = NULL;
else { $_217 = FALSE; break; }
$stack[] = $result; $result = $this->construct( $matchrule, "Call" );
$_213 = NULL;
do {
$key = "Word"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) );
$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" );
}
else { $_200 = FALSE; break; }
if (substr($this->string,$this->pos,1) == "(") {
else { $_213 = FALSE; break; }
if (substr($this->string,$this->pos,1) == '(') {
$this->pos += 1;
$result["text"] .= "(";
$result["text"] .= '(';
}
else { $_200 = FALSE; break; }
else { $_213 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "CallArguments"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_CallArguments(array_merge($substack, array($result))) ) );
$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" );
}
else { $_200 = FALSE; break; }
else { $_213 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == ")") {
if (substr($this->string,$this->pos,1) == ')') {
$this->pos += 1;
$result["text"] .= ")";
$result["text"] .= ')';
}
else { $_200 = FALSE; break; }
$_200 = TRUE; break;
else { $_213 = FALSE; break; }
$_213 = TRUE; break;
}
while(0);
if( $_200 === TRUE ) {
$subres = $result ;
$result = array_pop( $substack ) ;
if( $_213 === TRUE ) {
$subres = $result; $result = array_pop($stack);
$this->store( $result, $subres, 'Call' );
}
if( $_200 === FALSE) {
$result = array_pop( $substack ) ;
$_206 = FALSE; break;
if( $_213 === FALSE) {
$result = array_pop($stack);
$_217 = FALSE; break;
}
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_204 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_204->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_206 = FALSE; break; }
$_206 = TRUE; break;
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_217 = FALSE; break; }
$_217 = TRUE; break;
}
while(0);
if( $_206 === TRUE ) {
return $this->finalise( "Require", $result );
}
if( $_206 === FALSE) { return FALSE; }
if( $_217 === TRUE ) { return $this->finalise($result); }
if( $_217 === FALSE) { return FALSE; }
}
@ -1251,62 +1419,1066 @@ class SSTemplateParser extends Parser {
$res['php'] = "Requirements::".$sub['Method']['text'].'('.$sub['CallArguments']['php'].');';
}
/* OldTPart: "_t" < "(" < QuotedString (< "," < CallArguments)? > ")" */
function match_OldTPart ($substack = array()) {
$result = $this->construct( "OldTPart" );
$_222 = NULL;
/* CacheBlockArgument:
!( "if " | "unless " )
(
:DollarMarkedLookup |
:QuotedString |
:Lookup
) */
protected $match_CacheBlockArgument_typestack = array('CacheBlockArgument');
function match_CacheBlockArgument ($stack = array()) {
$matchrule = "CacheBlockArgument"; $result = $this->construct($matchrule, $matchrule, null);
$_237 = NULL;
do {
$_208 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_208->expand("_t") ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_222 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == "(") {
$this->pos += 1;
$result["text"] .= "(";
}
else { $_222 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "QuotedString"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_QuotedString(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_222 = FALSE; break; }
$res_219 = $result;
$pos_219 = $this->pos;
$_218 = NULL;
$res_225 = $result;
$pos_225 = $this->pos;
$_224 = NULL;
do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == ",") {
$this->pos += 1;
$result["text"] .= ",";
$_222 = NULL;
do {
$res_219 = $result;
$pos_219 = $this->pos;
if (( $subres = $this->literal( 'if ' ) ) !== FALSE) {
$result["text"] .= $subres;
$_222 = TRUE; break;
}
$result = $res_219;
$this->pos = $pos_219;
if (( $subres = $this->literal( 'unless ' ) ) !== FALSE) {
$result["text"] .= $subres;
$_222 = TRUE; break;
}
$result = $res_219;
$this->pos = $pos_219;
$_222 = FALSE; break;
}
else { $_218 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "CallArguments"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_CallArguments(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_218 = FALSE; break; }
$_218 = TRUE; break;
while(0);
if( $_222 === FALSE) { $_224 = FALSE; break; }
$_224 = TRUE; break;
}
while(0);
if( $_218 === FALSE) {
$result = $res_219;
$this->pos = $pos_219;
unset( $res_219 );
unset( $pos_219 );
if( $_224 === TRUE ) {
$result = $res_225;
$this->pos = $pos_225;
$_237 = FALSE; break;
}
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == ")") {
$this->pos += 1;
$result["text"] .= ")";
if( $_224 === FALSE) {
$result = $res_225;
$this->pos = $pos_225;
}
else { $_222 = FALSE; break; }
$_222 = TRUE; break;
$_235 = NULL;
do {
$_233 = NULL;
do {
$res_226 = $result;
$pos_226 = $this->pos;
$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" );
$_233 = TRUE; break;
}
$result = $res_226;
$this->pos = $pos_226;
$_231 = NULL;
do {
$res_228 = $result;
$pos_228 = $this->pos;
$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" );
$_231 = TRUE; break;
}
$result = $res_228;
$this->pos = $pos_228;
$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" );
$_231 = TRUE; break;
}
$result = $res_228;
$this->pos = $pos_228;
$_231 = FALSE; break;
}
while(0);
if( $_231 === TRUE ) { $_233 = TRUE; break; }
$result = $res_226;
$this->pos = $pos_226;
$_233 = FALSE; break;
}
while(0);
if( $_233 === FALSE) { $_235 = FALSE; break; }
$_235 = TRUE; break;
}
while(0);
if( $_235 === FALSE) { $_237 = FALSE; break; }
$_237 = TRUE; break;
}
while(0);
if( $_222 === TRUE ) {
return $this->finalise( "OldTPart", $result );
if( $_237 === TRUE ) { return $this->finalise($result); }
if( $_237 === FALSE) { return FALSE; }
}
function CacheBlockArgument_DollarMarkedLookup(&$res, $sub) {
$res['php'] = $sub['Lookup']['php'];
}
function CacheBlockArgument_QuotedString(&$res, $sub) {
$res['php'] = "'" . str_replace("'", "\\'", $sub['String']['text']) . "'";
}
function CacheBlockArgument_Lookup(&$res, $sub) {
$res['php'] = $sub['php'];
}
/* CacheBlockArguments: CacheBlockArgument ( < "," < CacheBlockArgument )* */
protected $match_CacheBlockArguments_typestack = array('CacheBlockArguments');
function match_CacheBlockArguments ($stack = array()) {
$matchrule = "CacheBlockArguments"; $result = $this->construct($matchrule, $matchrule, null);
$_246 = NULL;
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 ); }
else { $_246 = FALSE; break; }
while (true) {
$res_245 = $result;
$pos_245 = $this->pos;
$_244 = NULL;
do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == ',') {
$this->pos += 1;
$result["text"] .= ',';
}
else { $_244 = FALSE; break; }
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 ); }
else { $_244 = FALSE; break; }
$_244 = TRUE; break;
}
while(0);
if( $_244 === FALSE) {
$result = $res_245;
$this->pos = $pos_245;
unset( $res_245 );
unset( $pos_245 );
break;
}
}
$_246 = TRUE; break;
}
if( $_222 === FALSE) { return FALSE; }
while(0);
if( $_246 === TRUE ) { return $this->finalise($result); }
if( $_246 === FALSE) { return FALSE; }
}
function CacheBlockArguments_CacheBlockArgument(&$res, $sub) {
if (!empty($res['php'])) $res['php'] .= ".'_'.";
else $res['php'] = '';
$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']);
}
/* CacheBlockTemplate: (Comment | If | Require | OldI18NTag | ClosedBlock | OpenBlock | MalformedBlock | Injection | Text)+ */
protected $match_CacheBlockTemplate_typestack = array('CacheBlockTemplate','Template');
function match_CacheBlockTemplate ($stack = array()) {
$matchrule = "CacheBlockTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'CacheRestrictedTemplate'));
$count = 0;
while (true) {
$res_282 = $result;
$pos_282 = $this->pos;
$_281 = NULL;
do {
$_279 = NULL;
do {
$res_248 = $result;
$pos_248 = $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 );
$_279 = TRUE; break;
}
$result = $res_248;
$this->pos = $pos_248;
$_277 = NULL;
do {
$res_250 = $result;
$pos_250 = $this->pos;
$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_277 = TRUE; break;
}
$result = $res_250;
$this->pos = $pos_250;
$_275 = NULL;
do {
$res_252 = $result;
$pos_252 = $this->pos;
$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_275 = TRUE; break;
}
$result = $res_252;
$this->pos = $pos_252;
$_273 = NULL;
do {
$res_254 = $result;
$pos_254 = $this->pos;
$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_273 = TRUE; break;
}
$result = $res_254;
$this->pos = $pos_254;
$_271 = NULL;
do {
$res_256 = $result;
$pos_256 = $this->pos;
$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_271 = TRUE; break;
}
$result = $res_256;
$this->pos = $pos_256;
$_269 = NULL;
do {
$res_258 = $result;
$pos_258 = $this->pos;
$matcher = 'match_'.'OpenBlock'; $key = $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 );
$_269 = TRUE; break;
}
$result = $res_258;
$this->pos = $pos_258;
$_267 = NULL;
do {
$res_260 = $result;
$pos_260 = $this->pos;
$matcher = 'match_'.'MalformedBlock'; $key = $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 );
$_267 = TRUE; break;
}
$result = $res_260;
$this->pos = $pos_260;
$_265 = NULL;
do {
$res_262 = $result;
$pos_262 = $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 );
$_265 = TRUE; break;
}
$result = $res_262;
$this->pos = $pos_262;
$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 );
$_265 = TRUE; break;
}
$result = $res_262;
$this->pos = $pos_262;
$_265 = FALSE; break;
}
while(0);
if( $_265 === TRUE ) { $_267 = TRUE; break; }
$result = $res_260;
$this->pos = $pos_260;
$_267 = FALSE; break;
}
while(0);
if( $_267 === TRUE ) { $_269 = TRUE; break; }
$result = $res_258;
$this->pos = $pos_258;
$_269 = FALSE; break;
}
while(0);
if( $_269 === TRUE ) { $_271 = TRUE; break; }
$result = $res_256;
$this->pos = $pos_256;
$_271 = FALSE; break;
}
while(0);
if( $_271 === TRUE ) { $_273 = TRUE; break; }
$result = $res_254;
$this->pos = $pos_254;
$_273 = FALSE; break;
}
while(0);
if( $_273 === TRUE ) { $_275 = TRUE; break; }
$result = $res_252;
$this->pos = $pos_252;
$_275 = FALSE; break;
}
while(0);
if( $_275 === TRUE ) { $_277 = TRUE; break; }
$result = $res_250;
$this->pos = $pos_250;
$_277 = FALSE; break;
}
while(0);
if( $_277 === TRUE ) { $_279 = TRUE; break; }
$result = $res_248;
$this->pos = $pos_248;
$_279 = FALSE; break;
}
while(0);
if( $_279 === FALSE) { $_281 = FALSE; break; }
$_281 = TRUE; break;
}
while(0);
if( $_281 === FALSE) {
$result = $res_282;
$this->pos = $pos_282;
unset( $res_282 );
unset( $pos_282 );
break;
}
$count += 1;
}
if ($count > 0) { return $this->finalise($result); }
else { return FALSE; }
}
/* UncachedBlock:
'<%' < "uncached" < CacheBlockArguments? ( < Conditional:("if"|"unless") > Condition:IfArgument )? > '%>'
Template:$TemplateMatcher?
'<%' < 'end_' ("uncached"|"cached"|"cacheblock") > '%>' */
protected $match_UncachedBlock_typestack = array('UncachedBlock');
function match_UncachedBlock ($stack = array()) {
$matchrule = "UncachedBlock"; $result = $this->construct($matchrule, $matchrule, null);
$_319 = NULL;
do {
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_319 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_319 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$res_287 = $result;
$pos_287 = $this->pos;
$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 {
$result = $res_287;
$this->pos = $pos_287;
unset( $res_287 );
unset( $pos_287 );
}
$res_299 = $result;
$pos_299 = $this->pos;
$_298 = NULL;
do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" );
$_294 = NULL;
do {
$_292 = NULL;
do {
$res_289 = $result;
$pos_289 = $this->pos;
if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
$result["text"] .= $subres;
$_292 = TRUE; break;
}
$result = $res_289;
$this->pos = $pos_289;
if (( $subres = $this->literal( 'unless' ) ) !== FALSE) {
$result["text"] .= $subres;
$_292 = TRUE; break;
}
$result = $res_289;
$this->pos = $pos_289;
$_292 = FALSE; break;
}
while(0);
if( $_292 === FALSE) { $_294 = FALSE; break; }
$_294 = TRUE; break;
}
while(0);
if( $_294 === TRUE ) {
$subres = $result; $result = array_pop($stack);
$this->store( $result, $subres, 'Conditional' );
}
if( $_294 === FALSE) {
$result = array_pop($stack);
$_298 = FALSE; break;
}
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" );
}
else { $_298 = FALSE; break; }
$_298 = TRUE; break;
}
while(0);
if( $_298 === FALSE) {
$result = $res_299;
$this->pos = $pos_299;
unset( $res_299 );
unset( $pos_299 );
}
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_319 = FALSE; break; }
$res_302 = $result;
$pos_302 = $this->pos;
$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 {
$result = $res_302;
$this->pos = $pos_302;
unset( $res_302 );
unset( $pos_302 );
}
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_319 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_319 = FALSE; break; }
$_315 = NULL;
do {
$_313 = NULL;
do {
$res_306 = $result;
$pos_306 = $this->pos;
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
$result["text"] .= $subres;
$_313 = TRUE; break;
}
$result = $res_306;
$this->pos = $pos_306;
$_311 = NULL;
do {
$res_308 = $result;
$pos_308 = $this->pos;
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
$result["text"] .= $subres;
$_311 = TRUE; break;
}
$result = $res_308;
$this->pos = $pos_308;
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
$result["text"] .= $subres;
$_311 = TRUE; break;
}
$result = $res_308;
$this->pos = $pos_308;
$_311 = FALSE; break;
}
while(0);
if( $_311 === TRUE ) { $_313 = TRUE; break; }
$result = $res_306;
$this->pos = $pos_306;
$_313 = FALSE; break;
}
while(0);
if( $_313 === FALSE) { $_315 = FALSE; break; }
$_315 = TRUE; break;
}
while(0);
if( $_315 === FALSE) { $_319 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_319 = FALSE; break; }
$_319 = TRUE; break;
}
while(0);
if( $_319 === TRUE ) { return $this->finalise($result); }
if( $_319 === FALSE) { return FALSE; }
}
function UncachedBlock_Template(&$res, $sub){
$res['php'] = $sub['php'];
}
/* CacheRestrictedTemplate: (Comment | If | Require | CacheBlock | UncachedBlock | OldI18NTag | ClosedBlock | OpenBlock | MalformedBlock | Injection | Text)+ */
protected $match_CacheRestrictedTemplate_typestack = array('CacheRestrictedTemplate','Template');
function match_CacheRestrictedTemplate ($stack = array()) {
$matchrule = "CacheRestrictedTemplate"; $result = $this->construct($matchrule, $matchrule, null);
$count = 0;
while (true) {
$res_363 = $result;
$pos_363 = $this->pos;
$_362 = NULL;
do {
$_360 = NULL;
do {
$res_321 = $result;
$pos_321 = $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 );
$_360 = TRUE; break;
}
$result = $res_321;
$this->pos = $pos_321;
$_358 = NULL;
do {
$res_323 = $result;
$pos_323 = $this->pos;
$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_358 = TRUE; break;
}
$result = $res_323;
$this->pos = $pos_323;
$_356 = NULL;
do {
$res_325 = $result;
$pos_325 = $this->pos;
$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_356 = TRUE; break;
}
$result = $res_325;
$this->pos = $pos_325;
$_354 = NULL;
do {
$res_327 = $result;
$pos_327 = $this->pos;
$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_354 = TRUE; break;
}
$result = $res_327;
$this->pos = $pos_327;
$_352 = NULL;
do {
$res_329 = $result;
$pos_329 = $this->pos;
$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_352 = TRUE; break;
}
$result = $res_329;
$this->pos = $pos_329;
$_350 = NULL;
do {
$res_331 = $result;
$pos_331 = $this->pos;
$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_350 = TRUE; break;
}
$result = $res_331;
$this->pos = $pos_331;
$_348 = NULL;
do {
$res_333 = $result;
$pos_333 = $this->pos;
$matcher = 'match_'.'ClosedBlock'; $key = $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 );
$_348 = TRUE; break;
}
$result = $res_333;
$this->pos = $pos_333;
$_346 = NULL;
do {
$res_335 = $result;
$pos_335 = $this->pos;
$matcher = 'match_'.'OpenBlock'; $key = $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 );
$_346 = TRUE; break;
}
$result = $res_335;
$this->pos = $pos_335;
$_344 = NULL;
do {
$res_337 = $result;
$pos_337 = $this->pos;
$matcher = 'match_'.'MalformedBlock'; $key = $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 );
$_344 = TRUE; break;
}
$result = $res_337;
$this->pos = $pos_337;
$_342 = NULL;
do {
$res_339 = $result;
$pos_339 = $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 );
$_342 = TRUE; break;
}
$result = $res_339;
$this->pos = $pos_339;
$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 );
$_342 = TRUE; break;
}
$result = $res_339;
$this->pos = $pos_339;
$_342 = FALSE; break;
}
while(0);
if( $_342 === TRUE ) { $_344 = TRUE; break; }
$result = $res_337;
$this->pos = $pos_337;
$_344 = FALSE; break;
}
while(0);
if( $_344 === TRUE ) { $_346 = TRUE; break; }
$result = $res_335;
$this->pos = $pos_335;
$_346 = FALSE; break;
}
while(0);
if( $_346 === TRUE ) { $_348 = TRUE; break; }
$result = $res_333;
$this->pos = $pos_333;
$_348 = FALSE; break;
}
while(0);
if( $_348 === TRUE ) { $_350 = TRUE; break; }
$result = $res_331;
$this->pos = $pos_331;
$_350 = FALSE; break;
}
while(0);
if( $_350 === TRUE ) { $_352 = TRUE; break; }
$result = $res_329;
$this->pos = $pos_329;
$_352 = FALSE; break;
}
while(0);
if( $_352 === TRUE ) { $_354 = TRUE; break; }
$result = $res_327;
$this->pos = $pos_327;
$_354 = FALSE; break;
}
while(0);
if( $_354 === TRUE ) { $_356 = TRUE; break; }
$result = $res_325;
$this->pos = $pos_325;
$_356 = FALSE; break;
}
while(0);
if( $_356 === TRUE ) { $_358 = TRUE; break; }
$result = $res_323;
$this->pos = $pos_323;
$_358 = FALSE; break;
}
while(0);
if( $_358 === TRUE ) { $_360 = TRUE; break; }
$result = $res_321;
$this->pos = $pos_321;
$_360 = FALSE; break;
}
while(0);
if( $_360 === FALSE) { $_362 = FALSE; break; }
$_362 = TRUE; break;
}
while(0);
if( $_362 === FALSE) {
$result = $res_363;
$this->pos = $pos_363;
unset( $res_363 );
unset( $pos_363 );
break;
}
$count += 1;
}
if ($count > 0) { return $this->finalise($result); }
else { return FALSE; }
}
function CacheRestrictedTemplate_CacheBlock(&$res, $sub) {
throw new SSTemplateParseException('You cant have cache blocks nested within with, loop or control blocks that are within cache blocks', $this);
}
function CacheRestrictedTemplate_UncachedBlock(&$res, $sub) {
throw new SSTemplateParseException('You cant have uncache blocks nested within with, loop or control blocks that are within cache blocks', $this);
}
/* CacheBlock:
'<%' < CacheTag:("cached"|"cacheblock") < (CacheBlockArguments)? ( < Conditional:("if"|"unless") > Condition:IfArgument )? > '%>'
(CacheBlock | UncachedBlock | CacheBlockTemplate)*
'<%' < 'end_' ("cached"|"uncached"|"cacheblock") > '%>' */
protected $match_CacheBlock_typestack = array('CacheBlock');
function match_CacheBlock ($stack = array()) {
$matchrule = "CacheBlock"; $result = $this->construct($matchrule, $matchrule, null);
$_418 = NULL;
do {
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_418 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$stack[] = $result; $result = $this->construct( $matchrule, "CacheTag" );
$_371 = NULL;
do {
$_369 = NULL;
do {
$res_366 = $result;
$pos_366 = $this->pos;
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
$result["text"] .= $subres;
$_369 = TRUE; break;
}
$result = $res_366;
$this->pos = $pos_366;
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
$result["text"] .= $subres;
$_369 = TRUE; break;
}
$result = $res_366;
$this->pos = $pos_366;
$_369 = FALSE; break;
}
while(0);
if( $_369 === FALSE) { $_371 = FALSE; break; }
$_371 = TRUE; break;
}
while(0);
if( $_371 === TRUE ) {
$subres = $result; $result = array_pop($stack);
$this->store( $result, $subres, 'CacheTag' );
}
if( $_371 === FALSE) {
$result = array_pop($stack);
$_418 = FALSE; break;
}
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$res_376 = $result;
$pos_376 = $this->pos;
$_375 = NULL;
do {
$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 { $_375 = FALSE; break; }
$_375 = TRUE; break;
}
while(0);
if( $_375 === FALSE) {
$result = $res_376;
$this->pos = $pos_376;
unset( $res_376 );
unset( $pos_376 );
}
$res_388 = $result;
$pos_388 = $this->pos;
$_387 = NULL;
do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$stack[] = $result; $result = $this->construct( $matchrule, "Conditional" );
$_383 = NULL;
do {
$_381 = NULL;
do {
$res_378 = $result;
$pos_378 = $this->pos;
if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
$result["text"] .= $subres;
$_381 = TRUE; break;
}
$result = $res_378;
$this->pos = $pos_378;
if (( $subres = $this->literal( 'unless' ) ) !== FALSE) {
$result["text"] .= $subres;
$_381 = TRUE; break;
}
$result = $res_378;
$this->pos = $pos_378;
$_381 = FALSE; break;
}
while(0);
if( $_381 === FALSE) { $_383 = FALSE; break; }
$_383 = TRUE; break;
}
while(0);
if( $_383 === TRUE ) {
$subres = $result; $result = array_pop($stack);
$this->store( $result, $subres, 'Conditional' );
}
if( $_383 === FALSE) {
$result = array_pop($stack);
$_387 = FALSE; break;
}
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" );
}
else { $_387 = FALSE; break; }
$_387 = TRUE; break;
}
while(0);
if( $_387 === FALSE) {
$result = $res_388;
$this->pos = $pos_388;
unset( $res_388 );
unset( $pos_388 );
}
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_418 = FALSE; break; }
while (true) {
$res_401 = $result;
$pos_401 = $this->pos;
$_400 = NULL;
do {
$_398 = NULL;
do {
$res_391 = $result;
$pos_391 = $this->pos;
$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_398 = TRUE; break;
}
$result = $res_391;
$this->pos = $pos_391;
$_396 = NULL;
do {
$res_393 = $result;
$pos_393 = $this->pos;
$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_396 = TRUE; break;
}
$result = $res_393;
$this->pos = $pos_393;
$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 );
$_396 = TRUE; break;
}
$result = $res_393;
$this->pos = $pos_393;
$_396 = FALSE; break;
}
while(0);
if( $_396 === TRUE ) { $_398 = TRUE; break; }
$result = $res_391;
$this->pos = $pos_391;
$_398 = FALSE; break;
}
while(0);
if( $_398 === FALSE) { $_400 = FALSE; break; }
$_400 = TRUE; break;
}
while(0);
if( $_400 === FALSE) {
$result = $res_401;
$this->pos = $pos_401;
unset( $res_401 );
unset( $pos_401 );
break;
}
}
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_418 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_418 = FALSE; break; }
$_414 = NULL;
do {
$_412 = NULL;
do {
$res_405 = $result;
$pos_405 = $this->pos;
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
$result["text"] .= $subres;
$_412 = TRUE; break;
}
$result = $res_405;
$this->pos = $pos_405;
$_410 = NULL;
do {
$res_407 = $result;
$pos_407 = $this->pos;
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
$result["text"] .= $subres;
$_410 = TRUE; break;
}
$result = $res_407;
$this->pos = $pos_407;
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
$result["text"] .= $subres;
$_410 = TRUE; break;
}
$result = $res_407;
$this->pos = $pos_407;
$_410 = FALSE; break;
}
while(0);
if( $_410 === TRUE ) { $_412 = TRUE; break; }
$result = $res_405;
$this->pos = $pos_405;
$_412 = FALSE; break;
}
while(0);
if( $_412 === FALSE) { $_414 = FALSE; break; }
$_414 = TRUE; break;
}
while(0);
if( $_414 === FALSE) { $_418 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_418 = FALSE; break; }
$_418 = TRUE; break;
}
while(0);
if( $_418 === TRUE ) { return $this->finalise($result); }
if( $_418 === FALSE) { return FALSE; }
}
function CacheBlock__construct(&$res){
$res['subblocks'] = 0;
}
function CacheBlock_CacheBlockArguments(&$res, $sub){
$res['key'] = !empty($sub['php']) ? $sub['php'] : '';
}
function CacheBlock_Condition(&$res, $sub){
$res['condition'] = ($res['Conditional']['text'] == 'if' ? '(' : '!(') . $sub['php'] . ') && ';
}
function CacheBlock_CacheBlock(&$res, $sub){
$res['php'] .= $sub['php'];
}
function CacheBlock_UncachedBlock(&$res, $sub){
$res['php'] .= $sub['php'];
}
function CacheBlock_CacheBlockTemplate(&$res, $sub){
// Get the block counter
$block = ++$res['subblocks'];
// Build the key for this block from the passed cache key, the block index, and the sha hash of the template itself
$key = "'" . sha1($sub['php']) . (isset($res['key']) && $res['key'] ? "_'.sha1(".$res['key'].")" : "'") . ".'_$block'";
// Get any condition
$condition = isset($res['condition']) ? $res['condition'] : '';
$res['php'] .= 'if ('.$condition.'($partial = $cache->load('.$key.'))) $val .= $partial;' . PHP_EOL;
$res['php'] .= 'else { $oldval = $val; $val = "";' . PHP_EOL;
$res['php'] .= $sub['php'] . PHP_EOL;
$res['php'] .= $condition . ' $cache->save($val); $val = $oldval . $val;' . PHP_EOL;
$res['php'] .= '}';
}
/* OldTPart: "_t" < "(" < QuotedString (< "," < CallArguments)? > ")" */
protected $match_OldTPart_typestack = array('OldTPart');
function match_OldTPart ($stack = array()) {
$matchrule = "OldTPart"; $result = $this->construct($matchrule, $matchrule, null);
$_433 = NULL;
do {
if (( $subres = $this->literal( '_t' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_433 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == '(') {
$this->pos += 1;
$result["text"] .= '(';
}
else { $_433 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_433 = FALSE; break; }
$res_430 = $result;
$pos_430 = $this->pos;
$_429 = NULL;
do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == ',') {
$this->pos += 1;
$result["text"] .= ',';
}
else { $_429 = FALSE; break; }
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 ); }
else { $_429 = FALSE; break; }
$_429 = TRUE; break;
}
while(0);
if( $_429 === FALSE) {
$result = $res_430;
$this->pos = $pos_430;
unset( $res_430 );
unset( $pos_430 );
}
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == ')') {
$this->pos += 1;
$result["text"] .= ')';
}
else { $_433 = FALSE; break; }
$_433 = TRUE; break;
}
while(0);
if( $_433 === TRUE ) { return $this->finalise($result); }
if( $_433 === FALSE) { return FALSE; }
}
@ -1334,29 +2506,26 @@ class SSTemplateParser extends Parser {
}
/* OldTTag: "<%" < OldTPart > "%>" */
function match_OldTTag ($substack = array()) {
$result = $this->construct( "OldTTag" );
$_231 = NULL;
protected $match_OldTTag_typestack = array('OldTTag');
function match_OldTTag ($stack = array()) {
$matchrule = "OldTTag"; $result = $this->construct($matchrule, $matchrule, null);
$_440 = NULL;
do {
$_224 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_224->expand("<%") ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_231 = FALSE; break; }
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_440 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "OldTPart"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OldTPart(array_merge($substack, array($result))) ) );
$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))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_231 = FALSE; break; }
else { $_440 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_229 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_229->expand("%>") ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_231 = FALSE; break; }
$_231 = TRUE; break;
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_440 = FALSE; break; }
$_440 = TRUE; break;
}
while(0);
if( $_231 === TRUE ) {
return $this->finalise( "OldTTag", $result );
}
if( $_231 === FALSE) { return FALSE; }
if( $_440 === TRUE ) { return $this->finalise($result); }
if( $_440 === FALSE) { return FALSE; }
}
@ -1366,56 +2535,52 @@ class SSTemplateParser extends Parser {
}
/* OldSprintfTag: "<%" < "sprintf" < "(" < OldTPart < "," < CallArguments > ")" > "%>" */
function match_OldSprintfTag ($substack = array()) {
$result = $this->construct( "OldSprintfTag" );
$_251 = NULL;
protected $match_OldSprintfTag_typestack = array('OldSprintfTag');
function match_OldSprintfTag ($stack = array()) {
$matchrule = "OldSprintfTag"; $result = $this->construct($matchrule, $matchrule, null);
$_457 = NULL;
do {
$_233 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_233->expand("<%") ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_251 = FALSE; break; }
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_457 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_236 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_236->expand("sprintf") ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_251 = FALSE; break; }
if (( $subres = $this->literal( 'sprintf' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_457 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == "(") {
if (substr($this->string,$this->pos,1) == '(') {
$this->pos += 1;
$result["text"] .= "(";
$result["text"] .= '(';
}
else { $_251 = FALSE; break; }
else { $_457 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "OldTPart"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OldTPart(array_merge($substack, array($result))) ) );
$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))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_251 = FALSE; break; }
else { $_457 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == ",") {
if (substr($this->string,$this->pos,1) == ',') {
$this->pos += 1;
$result["text"] .= ",";
$result["text"] .= ',';
}
else { $_251 = FALSE; break; }
else { $_457 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "CallArguments"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_CallArguments(array_merge($substack, array($result))) ) );
$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 ); }
else { $_251 = FALSE; break; }
else { $_457 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == ")") {
if (substr($this->string,$this->pos,1) == ')') {
$this->pos += 1;
$result["text"] .= ")";
$result["text"] .= ')';
}
else { $_251 = FALSE; break; }
else { $_457 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_249 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_249->expand("%>") ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_251 = FALSE; break; }
$_251 = TRUE; break;
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_457 = FALSE; break; }
$_457 = TRUE; break;
}
while(0);
if( $_251 === TRUE ) {
return $this->finalise( "OldSprintfTag", $result );
}
if( $_251 === FALSE) { return FALSE; }
if( $_457 === TRUE ) { return $this->finalise($result); }
if( $_457 === FALSE) { return FALSE; }
}
@ -1433,35 +2598,34 @@ class SSTemplateParser extends Parser {
}
/* OldI18NTag: OldSprintfTag | OldTTag */
function match_OldI18NTag ($substack = array()) {
$result = $this->construct( "OldI18NTag" );
$_256 = NULL;
protected $match_OldI18NTag_typestack = array('OldI18NTag');
function match_OldI18NTag ($stack = array()) {
$matchrule = "OldI18NTag"; $result = $this->construct($matchrule, $matchrule, null);
$_462 = NULL;
do {
$res_253 = $result;
$pos_253 = $this->pos;
$key = "OldSprintfTag"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OldSprintfTag(array_merge($substack, array($result))) ) );
$res_459 = $result;
$pos_459 = $this->pos;
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_256 = TRUE; break;
$_462 = TRUE; break;
}
$result = $res_253;
$this->pos = $pos_253;
$key = "OldTTag"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OldTTag(array_merge($substack, array($result))) ) );
$result = $res_459;
$this->pos = $pos_459;
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_256 = TRUE; break;
$_462 = TRUE; break;
}
$result = $res_253;
$this->pos = $pos_253;
$_256 = FALSE; break;
$result = $res_459;
$this->pos = $pos_459;
$_462 = FALSE; break;
}
while(0);
if( $_256 === TRUE ) {
return $this->finalise( "OldI18NTag", $result );
}
if( $_256 === FALSE) { return FALSE; }
if( $_462 === TRUE ) { return $this->finalise($result); }
if( $_462 === FALSE) { return FALSE; }
}
@ -1471,251 +2635,283 @@ class SSTemplateParser extends Parser {
}
/* BlockArguments: :Argument ( < "," < :Argument)* */
function match_BlockArguments ($substack = array()) {
$result = $this->construct( "BlockArguments" );
$_265 = NULL;
protected $match_BlockArguments_typestack = array('BlockArguments');
function match_BlockArguments ($stack = array()) {
$matchrule = "BlockArguments"; $result = $this->construct($matchrule, $matchrule, null);
$_471 = NULL;
do {
$key = "Argument"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) );
$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, "Argument" );
}
else { $_265 = FALSE; break; }
else { $_471 = FALSE; break; }
while (true) {
$res_264 = $result;
$pos_264 = $this->pos;
$_263 = NULL;
$res_470 = $result;
$pos_470 = $this->pos;
$_469 = NULL;
do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
if (substr($this->string,$this->pos,1) == ",") {
if (substr($this->string,$this->pos,1) == ',') {
$this->pos += 1;
$result["text"] .= ",";
$result["text"] .= ',';
}
else { $_263 = FALSE; break; }
else { $_469 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "Argument"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) );
$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, "Argument" );
}
else { $_263 = FALSE; break; }
$_263 = TRUE; break;
else { $_469 = FALSE; break; }
$_469 = TRUE; break;
}
while(0);
if( $_263 === FALSE) {
$result = $res_264;
$this->pos = $pos_264;
unset( $res_264 );
unset( $pos_264 );
if( $_469 === FALSE) {
$result = $res_470;
$this->pos = $pos_470;
unset( $res_470 );
unset( $pos_470 );
break;
}
}
$_265 = TRUE; break;
$_471 = TRUE; break;
}
while(0);
if( $_265 === TRUE ) {
return $this->finalise( "BlockArguments", $result );
}
if( $_265 === FALSE) { return FALSE; }
if( $_471 === TRUE ) { return $this->finalise($result); }
if( $_471 === FALSE) { return FALSE; }
}
/* NotBlockTag: "end_" | (("if" | "else_if" | "else" | "require") ] ) */
function match_NotBlockTag ($substack = array()) {
$result = $this->construct( "NotBlockTag" );
$_292 = NULL;
/* NotBlockTag: "end_" | (("if" | "else_if" | "else" | "require" | "cached" | "uncached" | "cacheblock") ] ) */
protected $match_NotBlockTag_typestack = array('NotBlockTag');
function match_NotBlockTag ($stack = array()) {
$matchrule = "NotBlockTag"; $result = $this->construct($matchrule, $matchrule, null);
$_505 = NULL;
do {
$res_267 = $result;
$pos_267 = $this->pos;
$_268 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_268->expand("end_") ) ) !== FALSE) {
$res_473 = $result;
$pos_473 = $this->pos;
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) {
$result["text"] .= $subres;
$_292 = TRUE; break;
$_505 = TRUE; break;
}
$result = $res_267;
$this->pos = $pos_267;
$_290 = NULL;
$result = $res_473;
$this->pos = $pos_473;
$_503 = NULL;
do {
$_287 = NULL;
$_500 = NULL;
do {
$_285 = NULL;
$_498 = NULL;
do {
$res_270 = $result;
$pos_270 = $this->pos;
$_271 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_271->expand("if") ) ) !== FALSE) {
$res_475 = $result;
$pos_475 = $this->pos;
if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
$result["text"] .= $subres;
$_285 = TRUE; break;
$_498 = TRUE; break;
}
$result = $res_270;
$this->pos = $pos_270;
$_283 = NULL;
$result = $res_475;
$this->pos = $pos_475;
$_496 = NULL;
do {
$res_273 = $result;
$pos_273 = $this->pos;
$_274 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_274->expand("else_if") ) ) !== FALSE) {
$res_477 = $result;
$pos_477 = $this->pos;
if (( $subres = $this->literal( 'else_if' ) ) !== FALSE) {
$result["text"] .= $subres;
$_283 = TRUE; break;
$_496 = TRUE; break;
}
$result = $res_273;
$this->pos = $pos_273;
$_281 = NULL;
$result = $res_477;
$this->pos = $pos_477;
$_494 = NULL;
do {
$res_276 = $result;
$pos_276 = $this->pos;
$_277 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_277->expand("else") ) ) !== FALSE) {
$res_479 = $result;
$pos_479 = $this->pos;
if (( $subres = $this->literal( 'else' ) ) !== FALSE) {
$result["text"] .= $subres;
$_281 = TRUE; break;
$_494 = TRUE; break;
}
$result = $res_276;
$this->pos = $pos_276;
$_279 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_279->expand("require") ) ) !== FALSE) {
$result["text"] .= $subres;
$_281 = TRUE; break;
$result = $res_479;
$this->pos = $pos_479;
$_492 = NULL;
do {
$res_481 = $result;
$pos_481 = $this->pos;
if (( $subres = $this->literal( 'require' ) ) !== FALSE) {
$result["text"] .= $subres;
$_492 = TRUE; break;
}
$result = $res_481;
$this->pos = $pos_481;
$_490 = NULL;
do {
$res_483 = $result;
$pos_483 = $this->pos;
if (( $subres = $this->literal( 'cached' ) ) !== FALSE) {
$result["text"] .= $subres;
$_490 = TRUE; break;
}
$result = $res_483;
$this->pos = $pos_483;
$_488 = NULL;
do {
$res_485 = $result;
$pos_485 = $this->pos;
if (( $subres = $this->literal( 'uncached' ) ) !== FALSE) {
$result["text"] .= $subres;
$_488 = TRUE; break;
}
$result = $res_485;
$this->pos = $pos_485;
if (( $subres = $this->literal( 'cacheblock' ) ) !== FALSE) {
$result["text"] .= $subres;
$_488 = TRUE; break;
}
$result = $res_485;
$this->pos = $pos_485;
$_488 = FALSE; break;
}
while(0);
if( $_488 === TRUE ) { $_490 = TRUE; break; }
$result = $res_483;
$this->pos = $pos_483;
$_490 = FALSE; break;
}
while(0);
if( $_490 === TRUE ) { $_492 = TRUE; break; }
$result = $res_481;
$this->pos = $pos_481;
$_492 = FALSE; break;
}
$result = $res_276;
$this->pos = $pos_276;
$_281 = FALSE; break;
while(0);
if( $_492 === TRUE ) { $_494 = TRUE; break; }
$result = $res_479;
$this->pos = $pos_479;
$_494 = FALSE; break;
}
while(0);
if( $_281 === TRUE ) { $_283 = TRUE; break; }
$result = $res_273;
$this->pos = $pos_273;
$_283 = FALSE; break;
if( $_494 === TRUE ) { $_496 = TRUE; break; }
$result = $res_477;
$this->pos = $pos_477;
$_496 = FALSE; break;
}
while(0);
if( $_283 === TRUE ) { $_285 = TRUE; break; }
$result = $res_270;
$this->pos = $pos_270;
$_285 = FALSE; break;
if( $_496 === TRUE ) { $_498 = TRUE; break; }
$result = $res_475;
$this->pos = $pos_475;
$_498 = FALSE; break;
}
while(0);
if( $_285 === FALSE) { $_287 = FALSE; break; }
$_287 = TRUE; break;
if( $_498 === FALSE) { $_500 = FALSE; break; }
$_500 = TRUE; break;
}
while(0);
if( $_287 === FALSE) { $_290 = FALSE; break; }
if( $_500 === FALSE) { $_503 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_290 = FALSE; break; }
$_290 = TRUE; break;
else { $_503 = FALSE; break; }
$_503 = TRUE; break;
}
while(0);
if( $_290 === TRUE ) { $_292 = TRUE; break; }
$result = $res_267;
$this->pos = $pos_267;
$_292 = FALSE; break;
if( $_503 === TRUE ) { $_505 = TRUE; break; }
$result = $res_473;
$this->pos = $pos_473;
$_505 = FALSE; break;
}
while(0);
if( $_292 === TRUE ) {
return $this->finalise( "NotBlockTag", $result );
}
if( $_292 === FALSE) { return FALSE; }
if( $_505 === TRUE ) { return $this->finalise($result); }
if( $_505 === FALSE) { return FALSE; }
}
/* ClosedBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > Zap:'%>' :Template? '<%' < 'end_' '$BlockName' > '%>' */
function match_ClosedBlock ($substack = array()) {
$result = $this->construct( "ClosedBlock" );
$_319 = NULL;
/* ClosedBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > Zap:'%>' Template:$TemplateMatcher? '<%' < 'end_' '$BlockName' > '%>' */
protected $match_ClosedBlock_typestack = array('ClosedBlock');
function match_ClosedBlock ($stack = array()) {
$matchrule = "ClosedBlock"; $result = $this->construct($matchrule, $matchrule, null);
$_525 = NULL;
do {
$_294 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_294->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_319 = FALSE; break; }
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_525 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$res_297 = $result;
$pos_297 = $this->pos;
$key = "NotBlockTag"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_NotBlockTag(array_merge($substack, array($result))) ) );
$res_509 = $result;
$pos_509 = $this->pos;
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$result = $res_297;
$this->pos = $pos_297;
$_319 = FALSE; break;
$result = $res_509;
$this->pos = $pos_509;
$_525 = FALSE; break;
}
else {
$result = $res_297;
$this->pos = $pos_297;
$result = $res_509;
$this->pos = $pos_509;
}
$key = "Word"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) );
$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, "BlockName" );
}
else { $_319 = FALSE; break; }
$res_303 = $result;
$pos_303 = $this->pos;
$_302 = NULL;
else { $_525 = FALSE; break; }
$res_515 = $result;
$pos_515 = $this->pos;
$_514 = NULL;
do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_302 = FALSE; break; }
$key = "BlockArguments"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_BlockArguments(array_merge($substack, array($result))) ) );
else { $_514 = FALSE; break; }
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres, "BlockArguments" );
}
else { $_302 = FALSE; break; }
else { $_514 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_302 = FALSE; break; }
$_302 = TRUE; break;
else { $_514 = FALSE; break; }
$_514 = TRUE; break;
}
while(0);
if( $_302 === FALSE) {
$result = $res_303;
$this->pos = $pos_303;
unset( $res_303 );
unset( $pos_303 );
if( $_514 === FALSE) {
$result = $res_515;
$this->pos = $pos_515;
unset( $res_515 );
unset( $pos_515 );
}
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$substack[] = $result;
$result = $this->construct( "Zap" );
$_305 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_305->expand('%>') ) ) !== FALSE) {
$stack[] = $result; $result = $this->construct( $matchrule, "Zap" );
if (( $subres = $this->literal( '%>' ) ) !== FALSE) {
$result["text"] .= $subres;
$subres = $result ;
$result = array_pop( $substack ) ;
$subres = $result; $result = array_pop($stack);
$this->store( $result, $subres, 'Zap' );
}
else {
$result = array_pop( $substack ) ;
$_319 = FALSE; break;
$result = array_pop($stack);
$_525 = FALSE; break;
}
$res_308 = $result;
$pos_308 = $this->pos;
$key = "Template"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Template(array_merge($substack, array($result))) ) );
$res_518 = $result;
$pos_518 = $this->pos;
$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 {
$result = $res_308;
$this->pos = $pos_308;
unset( $res_308 );
unset( $pos_308 );
$result = $res_518;
$this->pos = $pos_518;
unset( $res_518 );
unset( $pos_518 );
}
$_309 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_309->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_319 = FALSE; break; }
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_525 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_312 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_312->expand('end_') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_319 = FALSE; break; }
$_314 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_314->expand('$BlockName') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_319 = FALSE; break; }
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_525 = FALSE; break; }
if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'BlockName').'' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_525 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_317 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_317->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_319 = FALSE; break; }
$_319 = TRUE; break;
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_525 = FALSE; break; }
$_525 = TRUE; break;
}
while(0);
if( $_319 === TRUE ) {
return $this->finalise( "ClosedBlock", $result );
}
if( $_319 === FALSE) { return FALSE; }
if( $_525 === TRUE ) { return $this->finalise($result); }
if( $_525 === FALSE) { return FALSE; }
}
@ -1809,68 +3005,65 @@ class SSTemplateParser extends Parser {
}
/* OpenBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > '%>' */
function match_OpenBlock ($substack = array()) {
$result = $this->construct( "OpenBlock" );
$_334 = NULL;
protected $match_OpenBlock_typestack = array('OpenBlock');
function match_OpenBlock ($stack = array()) {
$matchrule = "OpenBlock"; $result = $this->construct($matchrule, $matchrule, null);
$_538 = NULL;
do {
$_321 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_321->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_334 = FALSE; break; }
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_538 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$res_324 = $result;
$pos_324 = $this->pos;
$key = "NotBlockTag"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_NotBlockTag(array_merge($substack, array($result))) ) );
$res_529 = $result;
$pos_529 = $this->pos;
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$result = $res_324;
$this->pos = $pos_324;
$_334 = FALSE; break;
$result = $res_529;
$this->pos = $pos_529;
$_538 = FALSE; break;
}
else {
$result = $res_324;
$this->pos = $pos_324;
$result = $res_529;
$this->pos = $pos_529;
}
$key = "Word"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) );
$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, "BlockName" );
}
else { $_334 = FALSE; break; }
$res_330 = $result;
$pos_330 = $this->pos;
$_329 = NULL;
else { $_538 = FALSE; break; }
$res_535 = $result;
$pos_535 = $this->pos;
$_534 = NULL;
do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_329 = FALSE; break; }
$key = "BlockArguments"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_BlockArguments(array_merge($substack, array($result))) ) );
else { $_534 = FALSE; break; }
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres, "BlockArguments" );
}
else { $_329 = FALSE; break; }
else { $_534 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_329 = FALSE; break; }
$_329 = TRUE; break;
else { $_534 = FALSE; break; }
$_534 = TRUE; break;
}
while(0);
if( $_329 === FALSE) {
$result = $res_330;
$this->pos = $pos_330;
unset( $res_330 );
unset( $pos_330 );
if( $_534 === FALSE) {
$result = $res_535;
$this->pos = $pos_535;
unset( $res_535 );
unset( $pos_535 );
}
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_332 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_332->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_334 = FALSE; break; }
$_334 = TRUE; break;
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_538 = FALSE; break; }
$_538 = TRUE; break;
}
while(0);
if( $_334 === TRUE ) {
return $this->finalise( "OpenBlock", $result );
}
if( $_334 === FALSE) { return FALSE; }
if( $_538 === TRUE ) { return $this->finalise($result); }
if( $_538 === FALSE) { return FALSE; }
}
@ -1955,33 +3148,31 @@ class SSTemplateParser extends Parser {
return '$val .= $_SERVER[SCRIPT_URL];';
}
/* MismatchedEndBlock: '<%' < 'end_' Word > '%>' */
function match_MismatchedEndBlock ($substack = array()) {
$result = $this->construct( "MismatchedEndBlock" );
$_345 = NULL;
/* MismatchedEndBlock: '<%' < 'end_' :Word > '%>' */
protected $match_MismatchedEndBlock_typestack = array('MismatchedEndBlock');
function match_MismatchedEndBlock ($stack = array()) {
$matchrule = "MismatchedEndBlock"; $result = $this->construct($matchrule, $matchrule, null);
$_546 = NULL;
do {
$_336 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_336->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_345 = FALSE; break; }
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_546 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_339 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_339->expand('end_') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_345 = FALSE; break; }
$key = "Word"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_345 = FALSE; break; }
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_546 = FALSE; break; }
$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" );
}
else { $_546 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_343 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_343->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_345 = FALSE; break; }
$_345 = TRUE; break;
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_546 = FALSE; break; }
$_546 = TRUE; break;
}
while(0);
if( $_345 === TRUE ) {
return $this->finalise( "MismatchedEndBlock", $result );
}
if( $_345 === FALSE) { return FALSE; }
if( $_546 === TRUE ) { return $this->finalise($result); }
if( $_546 === FALSE) { return FALSE; }
}
@ -1992,84 +3183,81 @@ class SSTemplateParser extends Parser {
}
/* MalformedOpenTag: '<%' < !NotBlockTag Tag:Word !( ( [ :BlockArguments ] )? > '%>' ) */
function match_MalformedOpenTag ($substack = array()) {
$result = $this->construct( "MalformedOpenTag" );
$_362 = NULL;
protected $match_MalformedOpenTag_typestack = array('MalformedOpenTag');
function match_MalformedOpenTag ($stack = array()) {
$matchrule = "MalformedOpenTag"; $result = $this->construct($matchrule, $matchrule, null);
$_561 = NULL;
do {
$_347 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_347->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_362 = FALSE; break; }
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_561 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$res_350 = $result;
$pos_350 = $this->pos;
$key = "NotBlockTag"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_NotBlockTag(array_merge($substack, array($result))) ) );
$res_550 = $result;
$pos_550 = $this->pos;
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$result = $res_350;
$this->pos = $pos_350;
$_362 = FALSE; break;
$result = $res_550;
$this->pos = $pos_550;
$_561 = FALSE; break;
}
else {
$result = $res_350;
$this->pos = $pos_350;
$result = $res_550;
$this->pos = $pos_550;
}
$key = "Word"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) );
$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, "Tag" );
}
else { $_362 = FALSE; break; }
$res_361 = $result;
$pos_361 = $this->pos;
$_360 = NULL;
else { $_561 = FALSE; break; }
$res_560 = $result;
$pos_560 = $this->pos;
$_559 = NULL;
do {
$res_356 = $result;
$pos_356 = $this->pos;
$_355 = NULL;
$res_556 = $result;
$pos_556 = $this->pos;
$_555 = NULL;
do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_355 = FALSE; break; }
$key = "BlockArguments"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_BlockArguments(array_merge($substack, array($result))) ) );
else { $_555 = FALSE; break; }
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres, "BlockArguments" );
}
else { $_355 = FALSE; break; }
else { $_555 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_355 = FALSE; break; }
$_355 = TRUE; break;
else { $_555 = FALSE; break; }
$_555 = TRUE; break;
}
while(0);
if( $_355 === FALSE) {
$result = $res_356;
$this->pos = $pos_356;
unset( $res_356 );
unset( $pos_356 );
if( $_555 === FALSE) {
$result = $res_556;
$this->pos = $pos_556;
unset( $res_556 );
unset( $pos_556 );
}
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_358 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_358->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_360 = FALSE; break; }
$_360 = TRUE; break;
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_559 = FALSE; break; }
$_559 = TRUE; break;
}
while(0);
if( $_360 === TRUE ) {
$result = $res_361;
$this->pos = $pos_361;
$_362 = FALSE; break;
if( $_559 === TRUE ) {
$result = $res_560;
$this->pos = $pos_560;
$_561 = FALSE; break;
}
if( $_360 === FALSE) {
$result = $res_361;
$this->pos = $pos_361;
if( $_559 === FALSE) {
$result = $res_560;
$this->pos = $pos_560;
}
$_362 = TRUE; break;
$_561 = TRUE; break;
}
while(0);
if( $_362 === TRUE ) {
return $this->finalise( "MalformedOpenTag", $result );
}
if( $_362 === FALSE) { return FALSE; }
if( $_561 === TRUE ) { return $this->finalise($result); }
if( $_561 === FALSE) { return FALSE; }
}
@ -2080,66 +3268,60 @@ class SSTemplateParser extends Parser {
}
/* MalformedCloseTag: '<%' < Tag:('end_' :Word ) !( > '%>' ) */
function match_MalformedCloseTag ($substack = array()) {
$result = $this->construct( "MalformedCloseTag" );
$_378 = NULL;
protected $match_MalformedCloseTag_typestack = array('MalformedCloseTag');
function match_MalformedCloseTag ($stack = array()) {
$matchrule = "MalformedCloseTag"; $result = $this->construct($matchrule, $matchrule, null);
$_573 = NULL;
do {
$_364 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_364->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_378 = FALSE; break; }
if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_573 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$substack[] = $result;
$result = $this->construct( "Tag" );
$_370 = NULL;
$stack[] = $result; $result = $this->construct( $matchrule, "Tag" );
$_567 = NULL;
do {
$_367 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_367->expand('end_') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_370 = FALSE; break; }
$key = "Word"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) );
if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_567 = FALSE; break; }
$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" );
}
else { $_370 = FALSE; break; }
$_370 = TRUE; break;
else { $_567 = FALSE; break; }
$_567 = TRUE; break;
}
while(0);
if( $_370 === TRUE ) {
$subres = $result ;
$result = array_pop( $substack ) ;
if( $_567 === TRUE ) {
$subres = $result; $result = array_pop($stack);
$this->store( $result, $subres, 'Tag' );
}
if( $_370 === FALSE) {
$result = array_pop( $substack ) ;
$_378 = FALSE; break;
if( $_567 === FALSE) {
$result = array_pop($stack);
$_573 = FALSE; break;
}
$res_377 = $result;
$pos_377 = $this->pos;
$_376 = NULL;
$res_572 = $result;
$pos_572 = $this->pos;
$_571 = NULL;
do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_374 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_374->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_376 = FALSE; break; }
$_376 = TRUE; break;
if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_571 = FALSE; break; }
$_571 = TRUE; break;
}
while(0);
if( $_376 === TRUE ) {
$result = $res_377;
$this->pos = $pos_377;
$_378 = FALSE; break;
if( $_571 === TRUE ) {
$result = $res_572;
$this->pos = $pos_572;
$_573 = FALSE; break;
}
if( $_376 === FALSE) {
$result = $res_377;
$this->pos = $pos_377;
if( $_571 === FALSE) {
$result = $res_572;
$this->pos = $pos_572;
}
$_378 = TRUE; break;
$_573 = TRUE; break;
}
while(0);
if( $_378 === TRUE ) {
return $this->finalise( "MalformedCloseTag", $result );
}
if( $_378 === FALSE) { return FALSE; }
if( $_573 === TRUE ) { return $this->finalise($result); }
if( $_573 === FALSE) { return FALSE; }
}
@ -2150,94 +3332,88 @@ class SSTemplateParser extends Parser {
}
/* MalformedBlock: MalformedOpenTag | MalformedCloseTag */
function match_MalformedBlock ($substack = array()) {
$result = $this->construct( "MalformedBlock" );
$_383 = NULL;
protected $match_MalformedBlock_typestack = array('MalformedBlock');
function match_MalformedBlock ($stack = array()) {
$matchrule = "MalformedBlock"; $result = $this->construct($matchrule, $matchrule, null);
$_578 = NULL;
do {
$res_380 = $result;
$pos_380 = $this->pos;
$key = "MalformedOpenTag"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_MalformedOpenTag(array_merge($substack, array($result))) ) );
$res_575 = $result;
$pos_575 = $this->pos;
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_383 = TRUE; break;
$_578 = TRUE; break;
}
$result = $res_380;
$this->pos = $pos_380;
$key = "MalformedCloseTag"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_MalformedCloseTag(array_merge($substack, array($result))) ) );
$result = $res_575;
$this->pos = $pos_575;
$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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_383 = TRUE; break;
$_578 = TRUE; break;
}
$result = $res_380;
$this->pos = $pos_380;
$_383 = FALSE; break;
$result = $res_575;
$this->pos = $pos_575;
$_578 = FALSE; break;
}
while(0);
if( $_383 === TRUE ) {
return $this->finalise( "MalformedBlock", $result );
}
if( $_383 === FALSE) { return FALSE; }
if( $_578 === TRUE ) { return $this->finalise($result); }
if( $_578 === FALSE) { return FALSE; }
}
/* Comment: "<%--" (!"--%>" /./)+ "--%>" */
function match_Comment ($substack = array()) {
$result = $this->construct( "Comment" );
$_395 = NULL;
protected $match_Comment_typestack = array('Comment');
function match_Comment ($stack = array()) {
$matchrule = "Comment"; $result = $this->construct($matchrule, $matchrule, null);
$_586 = NULL;
do {
$_385 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_385->expand("<%--") ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_395 = FALSE; break; }
if (( $subres = $this->literal( '<%--' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_586 = FALSE; break; }
$count = 0;
while (true) {
$res_392 = $result;
$pos_392 = $this->pos;
$_391 = NULL;
$res_584 = $result;
$pos_584 = $this->pos;
$_583 = NULL;
do {
$res_388 = $result;
$pos_388 = $this->pos;
$_387 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_387->expand("--%>") ) ) !== FALSE) {
$res_581 = $result;
$pos_581 = $this->pos;
if (( $subres = $this->literal( '--%>' ) ) !== FALSE) {
$result["text"] .= $subres;
$result = $res_388;
$this->pos = $pos_388;
$_391 = FALSE; break;
$result = $res_581;
$this->pos = $pos_581;
$_583 = FALSE; break;
}
else {
$result = $res_388;
$this->pos = $pos_388;
$result = $res_581;
$this->pos = $pos_581;
}
$_389 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->rx( $_389->expand('/./') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_391 = FALSE; break; }
$_391 = TRUE; break;
if (( $subres = $this->rx( '/./' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_583 = FALSE; break; }
$_583 = TRUE; break;
}
while(0);
if( $_391 === FALSE) {
$result = $res_392;
$this->pos = $pos_392;
unset( $res_392 );
unset( $pos_392 );
if( $_583 === FALSE) {
$result = $res_584;
$this->pos = $pos_584;
unset( $res_584 );
unset( $pos_584 );
break;
}
$count += 1;
}
if ($count > 0) { }
else { $_395 = FALSE; break; }
$_393 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_393->expand("--%>") ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_395 = FALSE; break; }
$_395 = TRUE; break;
else { $_586 = FALSE; break; }
if (( $subres = $this->literal( '--%>' ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_586 = FALSE; break; }
$_586 = TRUE; break;
}
while(0);
if( $_395 === TRUE ) {
return $this->finalise( "Comment", $result );
}
if( $_395 === FALSE) { return FALSE; }
if( $_586 === TRUE ) { return $this->finalise($result); }
if( $_586 === FALSE) { return FALSE; }
}
@ -2245,433 +3421,234 @@ class SSTemplateParser extends Parser {
function Comment__construct(&$res) {
$res['php'] = '';
}
/* Text: /
(
(\\.) | # Any escaped character
([^<${]) | # Any character that isn't <, $ or {
(<[^%]) | # < if not followed by %
($[^A-Za-z_]) | # $ if not followed by A-Z, a-z or _
({[^$]) | # { if not followed by $
({$[^A-Za-z_]) # {$ if not followed A-Z, a-z or _
)+
/ */
function match_Text ($substack = array()) {
$result = array("name"=>"Text", "text"=>"");
$_397 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->rx( $_397->expand('/
(
(\\\\.) | # Any escaped character
([^<${]) | # Any character that isn\'t <, $ or {
(<[^%]) | # < if not followed by %
($[^A-Za-z_]) | # $ if not followed by A-Z, a-z or _
({[^$]) | # { if not followed by $
({$[^A-Za-z_]) # {$ if not followed A-Z, a-z or _
)+
/') ) ) !== FALSE) {
$result["text"] .= $subres;
return $result;
}
else { return FALSE; }
}
/* Template: (Comment | If | Require | OldI18NTag | ClosedBlock | OpenBlock | MalformedBlock | Injection | Text)+ */
function match_Template ($substack = array()) {
$result = $this->construct( "Template" );
$count = 0;
while (true) {
$res_433 = $result;
$pos_433 = $this->pos;
$_432 = NULL;
do {
$_430 = NULL;
do {
$res_399 = $result;
$pos_399 = $this->pos;
$key = "Comment"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Comment(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_430 = TRUE; break;
}
$result = $res_399;
$this->pos = $pos_399;
$_428 = NULL;
do {
$res_401 = $result;
$pos_401 = $this->pos;
$key = "If"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_If(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_428 = TRUE; break;
}
$result = $res_401;
$this->pos = $pos_401;
$_426 = NULL;
do {
$res_403 = $result;
$pos_403 = $this->pos;
$key = "Require"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Require(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_426 = TRUE; break;
}
$result = $res_403;
$this->pos = $pos_403;
$_424 = NULL;
do {
$res_405 = $result;
$pos_405 = $this->pos;
$key = "OldI18NTag"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OldI18NTag(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_424 = TRUE; break;
}
$result = $res_405;
$this->pos = $pos_405;
$_422 = NULL;
do {
$res_407 = $result;
$pos_407 = $this->pos;
$key = "ClosedBlock"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_ClosedBlock(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_422 = TRUE; break;
}
$result = $res_407;
$this->pos = $pos_407;
$_420 = NULL;
do {
$res_409 = $result;
$pos_409 = $this->pos;
$key = "OpenBlock"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OpenBlock(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_420 = TRUE; break;
}
$result = $res_409;
$this->pos = $pos_409;
$_418 = NULL;
do {
$res_411 = $result;
$pos_411 = $this->pos;
$key = "MalformedBlock"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_MalformedBlock(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_418 = TRUE; break;
}
$result = $res_411;
$this->pos = $pos_411;
$_416 = NULL;
do {
$res_413 = $result;
$pos_413 = $this->pos;
$key = "Injection"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Injection(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_416 = TRUE; break;
}
$result = $res_413;
$this->pos = $pos_413;
$key = "Text"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Text(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_416 = TRUE; break;
}
$result = $res_413;
$this->pos = $pos_413;
$_416 = FALSE; break;
}
while(0);
if( $_416 === TRUE ) { $_418 = TRUE; break; }
$result = $res_411;
$this->pos = $pos_411;
$_418 = FALSE; break;
}
while(0);
if( $_418 === TRUE ) { $_420 = TRUE; break; }
$result = $res_409;
$this->pos = $pos_409;
$_420 = FALSE; break;
}
while(0);
if( $_420 === TRUE ) { $_422 = TRUE; break; }
$result = $res_407;
$this->pos = $pos_407;
$_422 = FALSE; break;
}
while(0);
if( $_422 === TRUE ) { $_424 = TRUE; break; }
$result = $res_405;
$this->pos = $pos_405;
$_424 = FALSE; break;
}
while(0);
if( $_424 === TRUE ) { $_426 = TRUE; break; }
$result = $res_403;
$this->pos = $pos_403;
$_426 = FALSE; break;
}
while(0);
if( $_426 === TRUE ) { $_428 = TRUE; break; }
$result = $res_401;
$this->pos = $pos_401;
$_428 = FALSE; break;
}
while(0);
if( $_428 === TRUE ) { $_430 = TRUE; break; }
$result = $res_399;
$this->pos = $pos_399;
$_430 = FALSE; break;
}
while(0);
if( $_430 === FALSE) { $_432 = FALSE; break; }
$_432 = TRUE; break;
}
while(0);
if( $_432 === FALSE) {
$result = $res_433;
$this->pos = $pos_433;
unset( $res_433 );
unset( $pos_433 );
break;
}
$count += 1;
}
if ($count > 0) {
return $this->finalise( "Template", $result );
}
else { return FALSE; }
}
function Template__construct(&$res) {
$res['php'] = '';
}
function Template_Text(&$res, $sub) {
$text = $sub['text'];
$text = preg_replace(
'/href\s*\=\s*\"\#/',
'href="<?= SSViewer::{dlr}options[\'rewriteHashlinks\'] ? Convert::raw2att( {dlr}_SERVER[\'REQUEST_URI\'] ) : "" ?>#',
$text
);
// TODO: using heredocs means any left over $ symbols will trigger PHP lookups, as will any escapes
// Will it break backwards compatibility to use ' quoted strings, and escape just the ' characters?
$res['php'] .=
'$val .= <<<SSVIEWER' . PHP_EOL .
$text . PHP_EOL .
'SSVIEWER;' . PHP_EOL ;
}
function Template_STR(&$res, $sub) {
$res['php'] .= $sub['php'] . PHP_EOL ;
}
/* TopTemplate: (Comment | If | Require | OldI18NTag | ClosedBlock | OpenBlock | MalformedBlock | MismatchedEndBlock | Injection | Text)+ */
function match_TopTemplate ($substack = array()) {
$result = $this->construct( "TopTemplate" );
/* TopTemplate: (Comment | If | Require | CacheBlock | UncachedBlock | OldI18NTag | ClosedBlock | OpenBlock | MalformedBlock | MismatchedEndBlock | Injection | Text)+ */
protected $match_TopTemplate_typestack = array('TopTemplate','Template');
function match_TopTemplate ($stack = array()) {
$matchrule = "TopTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'Template'));
$count = 0;
while (true) {
$res_472 = $result;
$pos_472 = $this->pos;
$_471 = NULL;
$res_634 = $result;
$pos_634 = $this->pos;
$_633 = NULL;
do {
$_469 = NULL;
$_631 = NULL;
do {
$res_434 = $result;
$pos_434 = $this->pos;
$key = "Comment"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Comment(array_merge($substack, array($result))) ) );
$res_588 = $result;
$pos_588 = $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 );
$_469 = TRUE; break;
$_631 = TRUE; break;
}
$result = $res_434;
$this->pos = $pos_434;
$_467 = NULL;
$result = $res_588;
$this->pos = $pos_588;
$_629 = NULL;
do {
$res_436 = $result;
$pos_436 = $this->pos;
$key = "If"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_If(array_merge($substack, array($result))) ) );
$res_590 = $result;
$pos_590 = $this->pos;
$matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_467 = TRUE; break;
$_629 = TRUE; break;
}
$result = $res_436;
$this->pos = $pos_436;
$_465 = NULL;
$result = $res_590;
$this->pos = $pos_590;
$_627 = NULL;
do {
$res_438 = $result;
$pos_438 = $this->pos;
$key = "Require"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Require(array_merge($substack, array($result))) ) );
$res_592 = $result;
$pos_592 = $this->pos;
$matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_465 = TRUE; break;
$_627 = TRUE; break;
}
$result = $res_438;
$this->pos = $pos_438;
$_463 = NULL;
$result = $res_592;
$this->pos = $pos_592;
$_625 = NULL;
do {
$res_440 = $result;
$pos_440 = $this->pos;
$key = "OldI18NTag"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OldI18NTag(array_merge($substack, array($result))) ) );
$res_594 = $result;
$pos_594 = $this->pos;
$matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_463 = TRUE; break;
$_625 = TRUE; break;
}
$result = $res_440;
$this->pos = $pos_440;
$_461 = NULL;
$result = $res_594;
$this->pos = $pos_594;
$_623 = NULL;
do {
$res_442 = $result;
$pos_442 = $this->pos;
$key = "ClosedBlock"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_ClosedBlock(array_merge($substack, array($result))) ) );
$res_596 = $result;
$pos_596 = $this->pos;
$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_461 = TRUE; break;
$_623 = TRUE; break;
}
$result = $res_442;
$this->pos = $pos_442;
$_459 = NULL;
$result = $res_596;
$this->pos = $pos_596;
$_621 = NULL;
do {
$res_444 = $result;
$pos_444 = $this->pos;
$key = "OpenBlock"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OpenBlock(array_merge($substack, array($result))) ) );
$res_598 = $result;
$pos_598 = $this->pos;
$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_459 = TRUE; break;
$_621 = TRUE; break;
}
$result = $res_444;
$this->pos = $pos_444;
$_457 = NULL;
$result = $res_598;
$this->pos = $pos_598;
$_619 = NULL;
do {
$res_446 = $result;
$pos_446 = $this->pos;
$key = "MalformedBlock"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_MalformedBlock(array_merge($substack, array($result))) ) );
$res_600 = $result;
$pos_600 = $this->pos;
$matcher = 'match_'.'ClosedBlock'; $key = $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 );
$_457 = TRUE; break;
$_619 = TRUE; break;
}
$result = $res_446;
$this->pos = $pos_446;
$_455 = NULL;
$result = $res_600;
$this->pos = $pos_600;
$_617 = NULL;
do {
$res_448 = $result;
$pos_448 = $this->pos;
$key = "MismatchedEndBlock"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_MismatchedEndBlock(array_merge($substack, array($result))) ) );
$res_602 = $result;
$pos_602 = $this->pos;
$matcher = 'match_'.'OpenBlock'; $key = $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 );
$_455 = TRUE; break;
$_617 = TRUE; break;
}
$result = $res_448;
$this->pos = $pos_448;
$_453 = NULL;
$result = $res_602;
$this->pos = $pos_602;
$_615 = NULL;
do {
$res_450 = $result;
$pos_450 = $this->pos;
$key = "Injection"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Injection(array_merge($substack, array($result))) ) );
$res_604 = $result;
$pos_604 = $this->pos;
$matcher = 'match_'.'MalformedBlock'; $key = $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 );
$_453 = TRUE; break;
$_615 = TRUE; break;
}
$result = $res_450;
$this->pos = $pos_450;
$key = "Text"; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Text(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_453 = TRUE; break;
$result = $res_604;
$this->pos = $pos_604;
$_613 = NULL;
do {
$res_606 = $result;
$pos_606 = $this->pos;
$matcher = 'match_'.'MismatchedEndBlock'; $key = $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 );
$_613 = TRUE; break;
}
$result = $res_606;
$this->pos = $pos_606;
$_611 = NULL;
do {
$res_608 = $result;
$pos_608 = $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 );
$_611 = TRUE; break;
}
$result = $res_608;
$this->pos = $pos_608;
$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 );
$_611 = TRUE; break;
}
$result = $res_608;
$this->pos = $pos_608;
$_611 = FALSE; break;
}
while(0);
if( $_611 === TRUE ) { $_613 = TRUE; break; }
$result = $res_606;
$this->pos = $pos_606;
$_613 = FALSE; break;
}
$result = $res_450;
$this->pos = $pos_450;
$_453 = FALSE; break;
while(0);
if( $_613 === TRUE ) { $_615 = TRUE; break; }
$result = $res_604;
$this->pos = $pos_604;
$_615 = FALSE; break;
}
while(0);
if( $_453 === TRUE ) { $_455 = TRUE; break; }
$result = $res_448;
$this->pos = $pos_448;
$_455 = FALSE; break;
if( $_615 === TRUE ) { $_617 = TRUE; break; }
$result = $res_602;
$this->pos = $pos_602;
$_617 = FALSE; break;
}
while(0);
if( $_455 === TRUE ) { $_457 = TRUE; break; }
$result = $res_446;
$this->pos = $pos_446;
$_457 = FALSE; break;
if( $_617 === TRUE ) { $_619 = TRUE; break; }
$result = $res_600;
$this->pos = $pos_600;
$_619 = FALSE; break;
}
while(0);
if( $_457 === TRUE ) { $_459 = TRUE; break; }
$result = $res_444;
$this->pos = $pos_444;
$_459 = FALSE; break;
if( $_619 === TRUE ) { $_621 = TRUE; break; }
$result = $res_598;
$this->pos = $pos_598;
$_621 = FALSE; break;
}
while(0);
if( $_459 === TRUE ) { $_461 = TRUE; break; }
$result = $res_442;
$this->pos = $pos_442;
$_461 = FALSE; break;
if( $_621 === TRUE ) { $_623 = TRUE; break; }
$result = $res_596;
$this->pos = $pos_596;
$_623 = FALSE; break;
}
while(0);
if( $_461 === TRUE ) { $_463 = TRUE; break; }
$result = $res_440;
$this->pos = $pos_440;
$_463 = FALSE; break;
if( $_623 === TRUE ) { $_625 = TRUE; break; }
$result = $res_594;
$this->pos = $pos_594;
$_625 = FALSE; break;
}
while(0);
if( $_463 === TRUE ) { $_465 = TRUE; break; }
$result = $res_438;
$this->pos = $pos_438;
$_465 = FALSE; break;
if( $_625 === TRUE ) { $_627 = TRUE; break; }
$result = $res_592;
$this->pos = $pos_592;
$_627 = FALSE; break;
}
while(0);
if( $_465 === TRUE ) { $_467 = TRUE; break; }
$result = $res_436;
$this->pos = $pos_436;
$_467 = FALSE; break;
if( $_627 === TRUE ) { $_629 = TRUE; break; }
$result = $res_590;
$this->pos = $pos_590;
$_629 = FALSE; break;
}
while(0);
if( $_467 === TRUE ) { $_469 = TRUE; break; }
$result = $res_434;
$this->pos = $pos_434;
$_469 = FALSE; break;
if( $_629 === TRUE ) { $_631 = TRUE; break; }
$result = $res_588;
$this->pos = $pos_588;
$_631 = FALSE; break;
}
while(0);
if( $_469 === FALSE) { $_471 = FALSE; break; }
$_471 = TRUE; break;
if( $_631 === FALSE) { $_633 = FALSE; break; }
$_633 = TRUE; break;
}
while(0);
if( $_471 === FALSE) {
$result = $res_472;
$this->pos = $pos_472;
unset( $res_472 );
unset( $pos_472 );
if( $_633 === FALSE) {
$result = $res_634;
$this->pos = $pos_634;
unset( $res_634 );
unset( $pos_634 );
break;
}
$count += 1;
}
if ($count > 0) {
return $this->finalise( "TopTemplate", $result );
}
if ($count > 0) { return $this->finalise($result); }
else { return FALSE; }
}
@ -2685,13 +3662,59 @@ class SSTemplateParser extends Parser {
$res['php'] = "<?php" . PHP_EOL;
}
/**
* But otherwise handles producing the php the same as every other template block
*/
function TopTemplate_Text(&$res, $sub) { return $this->Template_Text($res, $sub); }
function TopTemplate_STR(&$res, $sub) { return $this->Template_STR($res, $sub); }
/* Text: /
(
(\\.) | # Any escaped character
([^<${]) | # Any character that isn't <, $ or {
(<[^%]) | # < if not followed by %
($[^A-Za-z_]) | # $ if not followed by A-Z, a-z or _
({[^$]) | # { if not followed by $
({$[^A-Za-z_]) # {$ if not followed A-Z, a-z or _
)+
/ */
protected $match_Text_typestack = array('Text');
function match_Text ($stack = array()) {
$matchrule = "Text"; $result = $this->construct($matchrule, $matchrule, null);
if (( $subres = $this->rx( '/
(
(\\\\.) | # Any escaped character
([^<${]) | # Any character that isn\'t <, $ or {
(<[^%]) | # < if not followed by %
($[^A-Za-z_]) | # $ if not followed by A-Z, a-z or _
({[^$]) | # { if not followed by $
({$[^A-Za-z_]) # {$ if not followed A-Z, a-z or _
)+
/' ) ) !== FALSE) {
$result["text"] .= $subres;
return $this->finalise($result);
}
else { return FALSE; }
}
/**
* We convert text
*/
function Text__finalise(&$res) {
$text = $res['text'];
$text = preg_replace(
'/href\s*\=\s*\"\#/',
'href="<?= SSViewer::{dlr}options[\'rewriteHashlinks\'] ? Convert::raw2att( {dlr}_SERVER[\'REQUEST_URI\'] ) : "" ?>#',
$text
);
// TODO: using heredocs means any left over $ symbols will trigger PHP lookups, as will any escapes
// Will it break backwards compatibility to use ' quoted strings, and escape just the ' characters?
$res['php'] .=
'$val .= <<<SSVIEWER' . PHP_EOL .
$text . PHP_EOL .
'SSVIEWER;' . PHP_EOL ;
}
/******************
* Here ends the parser itself. Below are utility methods to use the parser
*/

View File

@ -85,8 +85,28 @@ class SSTemplateParser extends Parser {
*/
protected $includeDebuggingComments = false;
/**
* Override the function that constructs the result arrays to also prepare a 'php' item in the array
*/
function construct($matchrule, $name, $arguments = null) {
$res = parent::construct($matchrule, $name, $arguments);
if (!isset($res['php'])) $res['php'] = '';
return $res;
}
/*!* SSTemplateParser
# Template is any structurally-complete portion of template (a full nested level in other words). It's the primary matcher,
# and is used by all enclosing blocks, as well as a base for the top level
Template: (Comment | If | Require | CacheBlock | UncachedBlock | OldI18NTag | ClosedBlock | OpenBlock | MalformedBlock | Injection | Text)+
*/
function Template_STR(&$res, $sub) {
$res['php'] .= $sub['php'] . PHP_EOL ;
}
/*!*
Word: / [A-Za-z_] [A-Za-z0-9_]* /
Number: / [0-9]+ /
Value: / [A-Za-z0-9_]+ /
@ -102,8 +122,7 @@ class SSTemplateParser extends Parser {
* to numbers when needed.
*/
function CallArguments_Argument(&$res, $sub) {
if (isset($res['php'])) $res['php'] .= ', ';
else $res['php'] = '';
if (!empty($res['php'])) $res['php'] .= ', ';
$res['php'] .= ($sub['ArgumentMode'] == 'default') ? $sub['string_php'] : str_replace('$$FINAL', 'XML_val', $sub['php']);
}
@ -258,11 +277,10 @@ class SSTemplateParser extends Parser {
*/
function Comparison_Argument(&$res, $sub) {
if ($sub['ArgumentMode'] == 'default') {
if (isset($res['php'])) $res['php'] .= $sub['string_php'];
if (!empty($res['php'])) $res['php'] .= $sub['string_php'];
else $res['php'] = str_replace('$$FINAL', 'XML_val', $sub['lookup_php']);
}
else {
if (!isset($res['php'])) $res['php'] = '';
$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']);
}
}
@ -279,10 +297,6 @@ class SSTemplateParser extends Parser {
PresenceCheck: (Not:'not' <)? Argument
*/
function PresenceCheck__construct(&$res) {
$res['php'] = '';
}
function PresenceCheck_Not(&$res, $sub) {
$res['php'] = '!';
}
@ -320,9 +334,6 @@ class SSTemplateParser extends Parser {
IfArgument: :IfArgumentPortion ( < :BooleanOperator < :IfArgumentPortion )*
*/
function IfArgument__construct(&$res){
$res['php'] = '';
}
function IfArgument_IfArgumentPortion(&$res, $sub) {
$res['php'] .= $sub['php'];
}
@ -337,9 +348,9 @@ class SSTemplateParser extends Parser {
# can have else_if and else tags in between the if tag and the end_if tag, and (B) they have a different
# argument structure to every other block
IfPart: '<%' < 'if' [ :IfArgument > '%>' :Template?
ElseIfPart: '<%' < 'else_if' [ :IfArgument > '%>' :Template
ElsePart: '<%' < 'else' > '%>' :Template
IfPart: '<%' < 'if' [ :IfArgument > '%>' Template:$TemplateMatcher?
ElseIfPart: '<%' < 'else_if' [ :IfArgument > '%>' Template:$TemplateMatcher
ElsePart: '<%' < 'else' > '%>' Template:$TemplateMatcher
If: IfPart ElseIfPart* ElsePart? '<%' < 'end_if' > '%>'
*/
@ -375,6 +386,120 @@ class SSTemplateParser extends Parser {
$res['php'] = "Requirements::".$sub['Method']['text'].'('.$sub['CallArguments']['php'].');';
}
/*!*
# Cache block arguments don't support free strings
CacheBlockArgument:
!( "if " | "unless " )
(
:DollarMarkedLookup |
:QuotedString |
:Lookup
)
*/
function CacheBlockArgument_DollarMarkedLookup(&$res, $sub) {
$res['php'] = $sub['Lookup']['php'];
}
function CacheBlockArgument_QuotedString(&$res, $sub) {
$res['php'] = "'" . str_replace("'", "\\'", $sub['String']['text']) . "'";
}
function CacheBlockArgument_Lookup(&$res, $sub) {
$res['php'] = $sub['php'];
}
/*!*
# Collects the arguments passed in to be part of the key of a cacheblock
CacheBlockArguments: CacheBlockArgument ( < "," < CacheBlockArgument )*
*/
function CacheBlockArguments_CacheBlockArgument(&$res, $sub) {
if (!empty($res['php'])) $res['php'] .= ".'_'.";
else $res['php'] = '';
$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']);
}
/*!*
# CacheBlockTemplate is the same as Template, but doesn't include cache blocks (because they're handled seperately)
CacheBlockTemplate extends Template (TemplateMatcher = CacheRestrictedTemplate); CacheBlock | UncachedBlock | => ''
*/
/*!*
UncachedBlock:
'<%' < "uncached" < CacheBlockArguments? ( < Conditional:("if"|"unless") > Condition:IfArgument )? > '%>'
Template:$TemplateMatcher?
'<%' < 'end_' ("uncached"|"cached"|"cacheblock") > '%>'
*/
function UncachedBlock_Template(&$res, $sub){
$res['php'] = $sub['php'];
}
/*!*
# CacheRestrictedTemplate is the same as Template, but doesn't allow cache blocks
CacheRestrictedTemplate extends Template
*/
function CacheRestrictedTemplate_CacheBlock(&$res, $sub) {
throw new SSTemplateParseException('You cant have cache blocks nested within with, loop or control blocks that are within cache blocks', $this);
}
function CacheRestrictedTemplate_UncachedBlock(&$res, $sub) {
throw new SSTemplateParseException('You cant have uncache blocks nested within with, loop or control blocks that are within cache blocks', $this);
}
/*!*
# The partial caching block
CacheBlock:
'<%' < CacheTag:("cached"|"cacheblock") < (CacheBlockArguments)? ( < Conditional:("if"|"unless") > Condition:IfArgument )? > '%>'
(CacheBlock | UncachedBlock | CacheBlockTemplate)*
'<%' < 'end_' ("cached"|"uncached"|"cacheblock") > '%>'
*/
function CacheBlock__construct(&$res){
$res['subblocks'] = 0;
}
function CacheBlock_CacheBlockArguments(&$res, $sub){
$res['key'] = !empty($sub['php']) ? $sub['php'] : '';
}
function CacheBlock_Condition(&$res, $sub){
$res['condition'] = ($res['Conditional']['text'] == 'if' ? '(' : '!(') . $sub['php'] . ') && ';
}
function CacheBlock_CacheBlock(&$res, $sub){
$res['php'] .= $sub['php'];
}
function CacheBlock_UncachedBlock(&$res, $sub){
$res['php'] .= $sub['php'];
}
function CacheBlock_CacheBlockTemplate(&$res, $sub){
// Get the block counter
$block = ++$res['subblocks'];
// Build the key for this block from the passed cache key, the block index, and the sha hash of the template itself
$key = "'" . sha1($sub['php']) . (isset($res['key']) && $res['key'] ? "_'.sha1(".$res['key'].")" : "'") . ".'_$block'";
// Get any condition
$condition = isset($res['condition']) ? $res['condition'] : '';
$res['php'] .= 'if ('.$condition.'($partial = $cache->load('.$key.'))) $val .= $partial;' . PHP_EOL;
$res['php'] .= 'else { $oldval = $val; $val = "";' . PHP_EOL;
$res['php'] .= $sub['php'] . PHP_EOL;
$res['php'] .= $condition . ' $cache->save($val); $val = $oldval . $val;' . PHP_EOL;
$res['php'] .= '}';
}
/*!*
# Deprecated old-style i18n _t and sprintf(_t block tags. We support a slightly more flexible version than we used
@ -461,12 +586,12 @@ class SSTemplateParser extends Parser {
# NotBlockTag matches against any word that might come after a "<%" that the generic open and closed block handlers
# shouldn't attempt to match against, because they're handled by more explicit matchers
NotBlockTag: "end_" | (("if" | "else_if" | "else" | "require") ] )
NotBlockTag: "end_" | (("if" | "else_if" | "else" | "require" | "cached" | "uncached" | "cacheblock") ] )
# Match against closed blocks - blocks with an opening and a closing tag that surround some internal portion of
# template
ClosedBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > Zap:'%>' :Template? '<%' < 'end_' '$BlockName' > '%>'
ClosedBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > Zap:'%>' Template:$TemplateMatcher? '<%' < 'end_' '$BlockName' > '%>'
*/
/**
@ -649,7 +774,7 @@ class SSTemplateParser extends Parser {
# Because of parser limitations, this can only be used at the top nesting level of a template. Other mismatched
# closing tags are detected as an invalid open tag
MismatchedEndBlock: '<%' < 'end_' Word > '%>'
MismatchedEndBlock: '<%' < 'end_' :Word > '%>'
*/
function MismatchedEndBlock__finalise(&$res) {
$blockname = $res['Word']['text'];
@ -696,7 +821,22 @@ class SSTemplateParser extends Parser {
function Comment__construct(&$res) {
$res['php'] = '';
}
/*!*
# TopTemplate is the same as Template, but should only be used at the top level (not nested), as it includes
# MismatchedEndBlock detection, which only works at the top level
TopTemplate extends Template (TemplateMatcher = Template); MalformedBlock => MalformedBlock | MismatchedEndBlock
*/
/**
* The TopTemplate also includes the opening stanza to start off the template
*/
function TopTemplate__construct(&$res) {
$res['php'] = "<?php" . PHP_EOL;
}
/*!*
# Text matches anything that isn't a template command (not an injection, block of any kind or comment)
@ -711,18 +851,14 @@ class SSTemplateParser extends Parser {
({$[^A-Za-z_]) # {$ if not followed A-Z, a-z or _
)+
/
# Template is any structurally-complete portion of template (a full nested level in other words). It's used
# by the block rules to recurse
Template: (Comment | If | Require | OldI18NTag | ClosedBlock | OpenBlock | MalformedBlock | Injection | Text)+
*/
function Template__construct(&$res) {
$res['php'] = '';
}
function Template_Text(&$res, $sub) {
$text = $sub['text'];
/**
* We convert text
*/
function Text__finalise(&$res) {
$text = $res['text'];
$text = preg_replace(
'/href\s*\=\s*\"\#/',
'href="<?= SSViewer::{dlr}options[\'rewriteHashlinks\'] ? Convert::raw2att( {dlr}_SERVER[\'REQUEST_URI\'] ) : "" ?>#',
@ -731,39 +867,13 @@ class SSTemplateParser extends Parser {
// TODO: using heredocs means any left over $ symbols will trigger PHP lookups, as will any escapes
// Will it break backwards compatibility to use ' quoted strings, and escape just the ' characters?
$res['php'] .=
'$val .= <<<SSVIEWER' . PHP_EOL .
$text . PHP_EOL .
'SSVIEWER;' . PHP_EOL ;
}
function Template_STR(&$res, $sub) {
$res['php'] .= $sub['php'] . PHP_EOL ;
}
/*!*
# TopTemplate is the same as Template, but should only be used at the top level (not nested), as it includes
# MismatchedEndBlock detection, which only works at the top level
TopTemplate: (Comment | If | Require | OldI18NTag | ClosedBlock | OpenBlock | MalformedBlock | MismatchedEndBlock | Injection | Text)+
*/
/**
* The TopTemplate also includes the opening stanza to start off the template
*/
function TopTemplate__construct(&$res) {
$res['php'] = "<?php" . PHP_EOL;
}
/**
* But otherwise handles producing the php the same as every other template block
*/
function TopTemplate_Text(&$res, $sub) { return $this->Template_Text($res, $sub); }
function TopTemplate_STR(&$res, $sub) { return $this->Template_STR($res, $sub); }
/******************
* Here ends the parser itself. Below are utility methods to use the parser
*/

View File

@ -186,6 +186,11 @@ class SSViewerCacheBlockTest extends SapphireTest {
$this->assertEquals($this->_runtemplate($template, array('Foo' => 2, 'Fooa' => 9, 'Foob' => 9, 'Bar' => 2, 'Bara' => 1)), ' 9 9 9 ');
}
function testNoErrorMessageForControlWithinCached() {
$this->_reset(true);
$this->_runtemplate('<% cached %><% control Foo %>$Bar<% end_control %><% end_cached %>');
}
/**
* @expectedException Exception
*/