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; 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_]* / */ /* Word: / [A-Za-z_] [A-Za-z0-9_]* / */
function match_Word ($substack = array()) { protected $match_Word_typestack = array('Word');
$result = array("name"=>"Word", "text"=>""); function match_Word ($stack = array()) {
$_0 = new ParserExpression( $this, $substack, $result ); $matchrule = "Word"; $result = $this->construct($matchrule, $matchrule, null);
if (( $subres = $this->rx( $_0->expand('/ [A-Za-z_] [A-Za-z0-9_]* /') ) ) !== FALSE) { if (( $subres = $this->rx( '/ [A-Za-z_] [A-Za-z0-9_]* /' ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
return $result; return $this->finalise($result);
} }
else { return FALSE; } else { return FALSE; }
} }
/* Number: / [0-9]+ / */ /* Number: / [0-9]+ / */
function match_Number ($substack = array()) { protected $match_Number_typestack = array('Number');
$result = array("name"=>"Number", "text"=>""); function match_Number ($stack = array()) {
$_2 = new ParserExpression( $this, $substack, $result ); $matchrule = "Number"; $result = $this->construct($matchrule, $matchrule, null);
if (( $subres = $this->rx( $_2->expand('/ [0-9]+ /') ) ) !== FALSE) { if (( $subres = $this->rx( '/ [0-9]+ /' ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
return $result; return $this->finalise($result);
} }
else { return FALSE; } else { return FALSE; }
} }
/* Value: / [A-Za-z0-9_]+ / */ /* Value: / [A-Za-z0-9_]+ / */
function match_Value ($substack = array()) { protected $match_Value_typestack = array('Value');
$result = array("name"=>"Value", "text"=>""); function match_Value ($stack = array()) {
$_4 = new ParserExpression( $this, $substack, $result ); $matchrule = "Value"; $result = $this->construct($matchrule, $matchrule, null);
if (( $subres = $this->rx( $_4->expand('/ [A-Za-z0-9_]+ /') ) ) !== FALSE) { if (( $subres = $this->rx( '/ [A-Za-z0-9_]+ /' ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
return $result; return $this->finalise($result);
} }
else { return FALSE; } else { return FALSE; }
} }
/* CallArguments: :Argument ( < "," < :Argument )* */ /* CallArguments: :Argument ( < "," < :Argument )* */
function match_CallArguments ($substack = array()) { protected $match_CallArguments_typestack = array('CallArguments');
$result = $this->construct( "CallArguments" ); function match_CallArguments ($stack = array()) {
$_13 = NULL; $matchrule = "CallArguments"; $result = $this->construct($matchrule, $matchrule, null);
$_53 = NULL;
do { do {
$key = "Argument"; $pos = $this->pos; $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Argument" ); $this->store( $result, $subres, "Argument" );
} }
else { $_13 = FALSE; break; } else { $_53 = FALSE; break; }
while (true) { while (true) {
$res_12 = $result; $res_52 = $result;
$pos_12 = $this->pos; $pos_52 = $this->pos;
$_11 = NULL; $_51 = NULL;
do { do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } 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; $this->pos += 1;
$result["text"] .= ","; $result["text"] .= ',';
} }
else { $_11 = FALSE; break; } else { $_51 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "Argument"; $pos = $this->pos; $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Argument" ); $this->store( $result, $subres, "Argument" );
} }
else { $_11 = FALSE; break; } else { $_51 = FALSE; break; }
$_11 = TRUE; break; $_51 = TRUE; break;
} }
while(0); while(0);
if( $_11 === FALSE) { if( $_51 === FALSE) {
$result = $res_12; $result = $res_52;
$this->pos = $pos_12; $this->pos = $pos_52;
unset( $res_12 ); unset( $res_52 );
unset( $pos_12 ); unset( $pos_52 );
break; break;
} }
} }
$_13 = TRUE; break; $_53 = TRUE; break;
} }
while(0); while(0);
if( $_13 === TRUE ) { if( $_53 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "CallArguments", $result ); if( $_53 === FALSE) { return FALSE; }
}
if( $_13 === FALSE) { return FALSE; }
} }
@ -160,188 +386,185 @@ class SSTemplateParser extends Parser {
* to numbers when needed. * to numbers when needed.
*/ */
function CallArguments_Argument(&$res, $sub) { function CallArguments_Argument(&$res, $sub) {
if (isset($res['php'])) $res['php'] .= ', '; if (!empty($res['php'])) $res['php'] .= ', ';
else $res['php'] = '';
$res['php'] .= ($sub['ArgumentMode'] == 'default') ? $sub['string_php'] : str_replace('$$FINAL', 'XML_val', $sub['php']); $res['php'] .= ($sub['ArgumentMode'] == 'default') ? $sub['string_php'] : str_replace('$$FINAL', 'XML_val', $sub['php']);
} }
/* Call: Method:Word ( "(" < :CallArguments? > ")" )? */ /* Call: Method:Word ( "(" < :CallArguments? > ")" )? */
function match_Call ($substack = array()) { protected $match_Call_typestack = array('Call');
$result = $this->construct( "Call" ); function match_Call ($stack = array()) {
$_23 = NULL; $matchrule = "Call"; $result = $this->construct($matchrule, $matchrule, null);
$_63 = NULL;
do { do {
$key = "Word"; $pos = $this->pos; $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Method" ); $this->store( $result, $subres, "Method" );
} }
else { $_23 = FALSE; break; } else { $_63 = FALSE; break; }
$res_22 = $result; $res_62 = $result;
$pos_22 = $this->pos; $pos_62 = $this->pos;
$_21 = NULL; $_61 = NULL;
do { do {
if (substr($this->string,$this->pos,1) == "(") { if (substr($this->string,$this->pos,1) == '(') {
$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; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$res_18 = $result; $res_58 = $result;
$pos_18 = $this->pos; $pos_58 = $this->pos;
$key = "CallArguments"; $pos = $this->pos; $matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_CallArguments(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "CallArguments" ); $this->store( $result, $subres, "CallArguments" );
} }
else { else {
$result = $res_18; $result = $res_58;
$this->pos = $pos_18; $this->pos = $pos_58;
unset( $res_18 ); unset( $res_58 );
unset( $pos_18 ); unset( $pos_58 );
} }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } 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; $this->pos += 1;
$result["text"] .= ")"; $result["text"] .= ')';
} }
else { $_21 = FALSE; break; } else { $_61 = FALSE; break; }
$_21 = TRUE; break; $_61 = TRUE; break;
} }
while(0); while(0);
if( $_21 === FALSE) { if( $_61 === FALSE) {
$result = $res_22; $result = $res_62;
$this->pos = $pos_22; $this->pos = $pos_62;
unset( $res_22 ); unset( $res_62 );
unset( $pos_22 ); unset( $pos_62 );
} }
$_23 = TRUE; break; $_63 = TRUE; break;
} }
while(0); while(0);
if( $_23 === TRUE ) { if( $_63 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "Call", $result ); if( $_63 === FALSE) { return FALSE; }
}
if( $_23 === FALSE) { return FALSE; }
} }
/* LookupStep: :Call &"." */ /* LookupStep: :Call &"." */
function match_LookupStep ($substack = array()) { protected $match_LookupStep_typestack = array('LookupStep');
$result = $this->construct( "LookupStep" ); function match_LookupStep ($stack = array()) {
$_27 = NULL; $matchrule = "LookupStep"; $result = $this->construct($matchrule, $matchrule, null);
$_67 = NULL;
do { do {
$key = "Call"; $pos = $this->pos; $matcher = 'match_'.'Call'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Call(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Call" ); $this->store( $result, $subres, "Call" );
} }
else { $_27 = FALSE; break; } else { $_67 = FALSE; break; }
$res_26 = $result; $res_66 = $result;
$pos_26 = $this->pos; $pos_66 = $this->pos;
if (substr($this->string,$this->pos,1) == ".") { if (substr($this->string,$this->pos,1) == '.') {
$this->pos += 1; $this->pos += 1;
$result["text"] .= "."; $result["text"] .= '.';
$result = $res_26; $result = $res_66;
$this->pos = $pos_26; $this->pos = $pos_66;
} }
else { else {
$result = $res_26; $result = $res_66;
$this->pos = $pos_26; $this->pos = $pos_66;
$_27 = FALSE; break; $_67 = FALSE; break;
} }
$_27 = TRUE; break; $_67 = TRUE; break;
} }
while(0); while(0);
if( $_27 === TRUE ) { if( $_67 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "LookupStep", $result ); if( $_67 === FALSE) { return FALSE; }
}
if( $_27 === FALSE) { return FALSE; }
} }
/* LastLookupStep: :Call */ /* LastLookupStep: :Call */
function match_LastLookupStep ($substack = array()) { protected $match_LastLookupStep_typestack = array('LastLookupStep');
$result = $this->construct( "LastLookupStep" ); function match_LastLookupStep ($stack = array()) {
$key = "Call"; $pos = $this->pos; $matchrule = "LastLookupStep"; $result = $this->construct($matchrule, $matchrule, null);
$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) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Call" ); $this->store( $result, $subres, "Call" );
return $this->finalise( "LastLookupStep", $result ); return $this->finalise($result);
} }
else { return FALSE; } else { return FALSE; }
} }
/* Lookup: LookupStep ("." LookupStep)* "." LastLookupStep | LastLookupStep */ /* Lookup: LookupStep ("." LookupStep)* "." LastLookupStep | LastLookupStep */
function match_Lookup ($substack = array()) { protected $match_Lookup_typestack = array('Lookup');
$result = $this->construct( "Lookup" ); function match_Lookup ($stack = array()) {
$_41 = NULL; $matchrule = "Lookup"; $result = $this->construct($matchrule, $matchrule, null);
$_81 = NULL;
do { do {
$res_30 = $result; $res_70 = $result;
$pos_30 = $this->pos; $pos_70 = $this->pos;
$_38 = NULL; $_78 = NULL;
do { do {
$key = "LookupStep"; $pos = $this->pos; $matcher = 'match_'.'LookupStep'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_LookupStep(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); } if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_38 = FALSE; break; } else { $_78 = FALSE; break; }
while (true) { while (true) {
$res_35 = $result; $res_75 = $result;
$pos_35 = $this->pos; $pos_75 = $this->pos;
$_34 = NULL; $_74 = NULL;
do { do {
if (substr($this->string,$this->pos,1) == ".") { if (substr($this->string,$this->pos,1) == '.') {
$this->pos += 1; $this->pos += 1;
$result["text"] .= "."; $result["text"] .= '.';
} }
else { $_34 = FALSE; break; } else { $_74 = FALSE; break; }
$key = "LookupStep"; $pos = $this->pos; $matcher = 'match_'.'LookupStep'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_LookupStep(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
} }
else { $_34 = FALSE; break; } else { $_74 = FALSE; break; }
$_34 = TRUE; break; $_74 = TRUE; break;
} }
while(0); while(0);
if( $_34 === FALSE) { if( $_74 === FALSE) {
$result = $res_35; $result = $res_75;
$this->pos = $pos_35; $this->pos = $pos_75;
unset( $res_35 ); unset( $res_75 );
unset( $pos_35 ); unset( $pos_75 );
break; break;
} }
} }
if (substr($this->string,$this->pos,1) == ".") { if (substr($this->string,$this->pos,1) == '.') {
$this->pos += 1; $this->pos += 1;
$result["text"] .= "."; $result["text"] .= '.';
} }
else { $_38 = FALSE; break; } else { $_78 = FALSE; break; }
$key = "LastLookupStep"; $pos = $this->pos; $matcher = 'match_'.'LastLookupStep'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_LastLookupStep(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); } if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_38 = FALSE; break; } else { $_78 = FALSE; break; }
$_38 = TRUE; break; $_78 = TRUE; break;
} }
while(0); while(0);
if( $_38 === TRUE ) { $_41 = TRUE; break; } if( $_78 === TRUE ) { $_81 = TRUE; break; }
$result = $res_30; $result = $res_70;
$this->pos = $pos_30; $this->pos = $pos_70;
$key = "LastLookupStep"; $pos = $this->pos; $matcher = 'match_'.'LastLookupStep'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_LastLookupStep(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_41 = TRUE; break; $_81 = TRUE; break;
} }
$result = $res_30; $result = $res_70;
$this->pos = $pos_30; $this->pos = $pos_70;
$_41 = FALSE; break; $_81 = FALSE; break;
} }
while(0); while(0);
if( $_41 === TRUE ) { if( $_81 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "Lookup", $result ); if( $_81 === FALSE) { return FALSE; }
}
if( $_41 === FALSE) { return FALSE; }
} }
@ -379,90 +602,86 @@ class SSTemplateParser extends Parser {
} }
/* SimpleInjection: '$' :Lookup */ /* SimpleInjection: '$' :Lookup */
function match_SimpleInjection ($substack = array()) { protected $match_SimpleInjection_typestack = array('SimpleInjection');
$result = $this->construct( "SimpleInjection" ); function match_SimpleInjection ($stack = array()) {
$_45 = NULL; $matchrule = "SimpleInjection"; $result = $this->construct($matchrule, $matchrule, null);
$_85 = NULL;
do { do {
if (substr($this->string,$this->pos,1) == '$') { if (substr($this->string,$this->pos,1) == '$') {
$this->pos += 1; $this->pos += 1;
$result["text"] .= '$'; $result["text"] .= '$';
} }
else { $_45 = FALSE; break; } else { $_85 = FALSE; break; }
$key = "Lookup"; $pos = $this->pos; $matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Lookup(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Lookup" ); $this->store( $result, $subres, "Lookup" );
} }
else { $_45 = FALSE; break; } else { $_85 = FALSE; break; }
$_45 = TRUE; break; $_85 = TRUE; break;
} }
while(0); while(0);
if( $_45 === TRUE ) { if( $_85 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "SimpleInjection", $result ); if( $_85 === FALSE) { return FALSE; }
}
if( $_45 === FALSE) { return FALSE; }
} }
/* BracketInjection: '{$' :Lookup "}" */ /* BracketInjection: '{$' :Lookup "}" */
function match_BracketInjection ($substack = array()) { protected $match_BracketInjection_typestack = array('BracketInjection');
$result = $this->construct( "BracketInjection" ); function match_BracketInjection ($stack = array()) {
$_51 = NULL; $matchrule = "BracketInjection"; $result = $this->construct($matchrule, $matchrule, null);
$_90 = NULL;
do { do {
$_47 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '{$' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_47->expand('{$') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_90 = FALSE; break; }
else { $_51 = FALSE; break; } $matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
$key = "Lookup"; $pos = $this->pos; $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Lookup(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Lookup" ); $this->store( $result, $subres, "Lookup" );
} }
else { $_51 = FALSE; break; } else { $_90 = FALSE; break; }
if (substr($this->string,$this->pos,1) == "}") { if (substr($this->string,$this->pos,1) == '}') {
$this->pos += 1; $this->pos += 1;
$result["text"] .= "}"; $result["text"] .= '}';
} }
else { $_51 = FALSE; break; } else { $_90 = FALSE; break; }
$_51 = TRUE; break; $_90 = TRUE; break;
} }
while(0); while(0);
if( $_51 === TRUE ) { if( $_90 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "BracketInjection", $result ); if( $_90 === FALSE) { return FALSE; }
}
if( $_51 === FALSE) { return FALSE; }
} }
/* Injection: BracketInjection | SimpleInjection */ /* Injection: BracketInjection | SimpleInjection */
function match_Injection ($substack = array()) { protected $match_Injection_typestack = array('Injection');
$result = $this->construct( "Injection" ); function match_Injection ($stack = array()) {
$_56 = NULL; $matchrule = "Injection"; $result = $this->construct($matchrule, $matchrule, null);
$_95 = NULL;
do { do {
$res_53 = $result; $res_92 = $result;
$pos_53 = $this->pos; $pos_92 = $this->pos;
$key = "BracketInjection"; $pos = $this->pos; $matcher = 'match_'.'BracketInjection'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_BracketInjection(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_56 = TRUE; break; $_95 = TRUE; break;
} }
$result = $res_53; $result = $res_92;
$this->pos = $pos_53; $this->pos = $pos_92;
$key = "SimpleInjection"; $pos = $this->pos; $matcher = 'match_'.'SimpleInjection'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_SimpleInjection(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_56 = TRUE; break; $_95 = TRUE; break;
} }
$result = $res_53; $result = $res_92;
$this->pos = $pos_53; $this->pos = $pos_92;
$_56 = FALSE; break; $_95 = FALSE; break;
} }
while(0); while(0);
if( $_56 === TRUE ) { if( $_95 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "Injection", $result ); if( $_95 === FALSE) { return FALSE; }
}
if( $_56 === FALSE) { return FALSE; }
} }
@ -472,13 +691,14 @@ class SSTemplateParser extends Parser {
} }
/* DollarMarkedLookup: SimpleInjection */ /* DollarMarkedLookup: SimpleInjection */
function match_DollarMarkedLookup ($substack = array()) { protected $match_DollarMarkedLookup_typestack = array('DollarMarkedLookup');
$result = $this->construct( "DollarMarkedLookup" ); function match_DollarMarkedLookup ($stack = array()) {
$key = "SimpleInjection"; $pos = $this->pos; $matchrule = "DollarMarkedLookup"; $result = $this->construct($matchrule, $matchrule, null);
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_SimpleInjection(array_merge($substack, array($result))) ) ); $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) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
return $this->finalise( "DollarMarkedLookup", $result ); return $this->finalise($result);
} }
else { return FALSE; } else { return FALSE; }
} }
@ -490,160 +710,151 @@ class SSTemplateParser extends Parser {
} }
/* QuotedString: q:/['"]/ String:/ (\\\\ | \\. | [^$q\\])* / '$q' */ /* QuotedString: q:/['"]/ String:/ (\\\\ | \\. | [^$q\\])* / '$q' */
function match_QuotedString ($substack = array()) { protected $match_QuotedString_typestack = array('QuotedString');
$result = $this->construct( "QuotedString" ); function match_QuotedString ($stack = array()) {
$_67 = NULL; $matchrule = "QuotedString"; $result = $this->construct($matchrule, $matchrule, null);
$_101 = NULL;
do { do {
$substack[] = $result; $stack[] = $result; $result = $this->construct( $matchrule, "q" );
$result = $this->construct( "q" ); if (( $subres = $this->rx( '/[\'"]/' ) ) !== FALSE) {
$_59 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->rx( $_59->expand('/[\'"]/') ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$subres = $result ; $subres = $result; $result = array_pop($stack);
$result = array_pop( $substack ) ;
$this->store( $result, $subres, 'q' ); $this->store( $result, $subres, 'q' );
} }
else { else {
$result = array_pop( $substack ) ; $result = array_pop($stack);
$_67 = FALSE; break; $_101 = FALSE; break;
} }
$substack[] = $result; $stack[] = $result; $result = $this->construct( $matchrule, "String" );
$result = $this->construct( "String" ); if (( $subres = $this->rx( '/ (\\\\\\\\ | \\\\. | [^'.$this->expression($result, $stack, 'q').'\\\\])* /' ) ) !== FALSE) {
$_62 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->rx( $_62->expand('/ (\\\\\\\\ | \\\\. | [^$q\\\\])* /') ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$subres = $result ; $subres = $result; $result = array_pop($stack);
$result = array_pop( $substack ) ;
$this->store( $result, $subres, 'String' ); $this->store( $result, $subres, 'String' );
} }
else { else {
$result = array_pop( $substack ) ; $result = array_pop($stack);
$_67 = FALSE; break; $_101 = FALSE; break;
} }
$_65 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'q').'' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_65->expand('$q') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_101 = FALSE; break; }
else { $_67 = FALSE; break; } $_101 = TRUE; break;
$_67 = TRUE; break;
} }
while(0); while(0);
if( $_67 === TRUE ) { if( $_101 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "QuotedString", $result ); if( $_101 === FALSE) { return FALSE; }
}
if( $_67 === FALSE) { return FALSE; }
} }
/* FreeString: /[^,)%!=|&]+/ */ /* FreeString: /[^,)%!=|&]+/ */
function match_FreeString ($substack = array()) { protected $match_FreeString_typestack = array('FreeString');
$result = array("name"=>"FreeString", "text"=>""); function match_FreeString ($stack = array()) {
$_69 = new ParserExpression( $this, $substack, $result ); $matchrule = "FreeString"; $result = $this->construct($matchrule, $matchrule, null);
if (( $subres = $this->rx( $_69->expand('/[^,)%!=|&]+/') ) ) !== FALSE) { if (( $subres = $this->rx( '/[^,)%!=|&]+/' ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
return $result; return $this->finalise($result);
} }
else { return FALSE; } else { return FALSE; }
} }
/* Argument: /* Argument:
:DollarMarkedLookup | :DollarMarkedLookup |
:QuotedString | :QuotedString |
:Lookup !(< FreeString)| :Lookup !(< FreeString)|
:FreeString */ :FreeString */
function match_Argument ($substack = array()) { protected $match_Argument_typestack = array('Argument');
$result = $this->construct( "Argument" ); function match_Argument ($stack = array()) {
$_88 = NULL; $matchrule = "Argument"; $result = $this->construct($matchrule, $matchrule, null);
$_121 = NULL;
do { do {
$res_71 = $result; $res_104 = $result;
$pos_71 = $this->pos; $pos_104 = $this->pos;
$key = "DollarMarkedLookup"; $pos = $this->pos; $matcher = 'match_'.'DollarMarkedLookup'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_DollarMarkedLookup(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "DollarMarkedLookup" ); $this->store( $result, $subres, "DollarMarkedLookup" );
$_88 = TRUE; break; $_121 = TRUE; break;
} }
$result = $res_71; $result = $res_104;
$this->pos = $pos_71; $this->pos = $pos_104;
$_86 = NULL; $_119 = NULL;
do { do {
$res_73 = $result; $res_106 = $result;
$pos_73 = $this->pos; $pos_106 = $this->pos;
$key = "QuotedString"; $pos = $this->pos; $matcher = 'match_'.'QuotedString'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_QuotedString(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "QuotedString" ); $this->store( $result, $subres, "QuotedString" );
$_86 = TRUE; break; $_119 = TRUE; break;
} }
$result = $res_73; $result = $res_106;
$this->pos = $pos_73; $this->pos = $pos_106;
$_84 = NULL; $_117 = NULL;
do { do {
$res_75 = $result; $res_108 = $result;
$pos_75 = $this->pos; $pos_108 = $this->pos;
$_81 = NULL; $_114 = NULL;
do { do {
$key = "Lookup"; $pos = $this->pos; $matcher = 'match_'.'Lookup'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Lookup(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Lookup" ); $this->store( $result, $subres, "Lookup" );
} }
else { $_81 = FALSE; break; } else { $_114 = FALSE; break; }
$res_80 = $result; $res_113 = $result;
$pos_80 = $this->pos; $pos_113 = $this->pos;
$_79 = NULL; $_112 = NULL;
do { do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "FreeString"; $pos = $this->pos; $matcher = 'match_'.'FreeString'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_FreeString(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
} }
else { $_79 = FALSE; break; } else { $_112 = FALSE; break; }
$_79 = TRUE; break; $_112 = TRUE; break;
} }
while(0); while(0);
if( $_79 === TRUE ) { if( $_112 === TRUE ) {
$result = $res_80; $result = $res_113;
$this->pos = $pos_80; $this->pos = $pos_113;
$_81 = FALSE; break; $_114 = FALSE; break;
} }
if( $_79 === FALSE) { if( $_112 === FALSE) {
$result = $res_80; $result = $res_113;
$this->pos = $pos_80; $this->pos = $pos_113;
} }
$_81 = TRUE; break; $_114 = TRUE; break;
} }
while(0); while(0);
if( $_81 === TRUE ) { $_84 = TRUE; break; } if( $_114 === TRUE ) { $_117 = TRUE; break; }
$result = $res_75; $result = $res_108;
$this->pos = $pos_75; $this->pos = $pos_108;
$key = "FreeString"; $pos = $this->pos; $matcher = 'match_'.'FreeString'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_FreeString(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "FreeString" ); $this->store( $result, $subres, "FreeString" );
$_84 = TRUE; break; $_117 = TRUE; break;
} }
$result = $res_75; $result = $res_108;
$this->pos = $pos_75; $this->pos = $pos_108;
$_84 = FALSE; break; $_117 = FALSE; break;
} }
while(0); while(0);
if( $_84 === TRUE ) { $_86 = TRUE; break; } if( $_117 === TRUE ) { $_119 = TRUE; break; }
$result = $res_73; $result = $res_106;
$this->pos = $pos_73; $this->pos = $pos_106;
$_86 = FALSE; break; $_119 = FALSE; break;
} }
while(0); while(0);
if( $_86 === TRUE ) { $_88 = TRUE; break; } if( $_119 === TRUE ) { $_121 = TRUE; break; }
$result = $res_71; $result = $res_104;
$this->pos = $pos_71; $this->pos = $pos_104;
$_88 = FALSE; break; $_121 = FALSE; break;
} }
while(0); while(0);
if( $_88 === TRUE ) { if( $_121 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "Argument", $result ); if( $_121 === FALSE) { return FALSE; }
}
if( $_88 === FALSE) { return FALSE; }
} }
@ -691,90 +902,85 @@ class SSTemplateParser extends Parser {
} }
/* ComparisonOperator: "==" | "!=" | "=" */ /* ComparisonOperator: "==" | "!=" | "=" */
function match_ComparisonOperator ($substack = array()) { protected $match_ComparisonOperator_typestack = array('ComparisonOperator');
$result = $this->construct( "ComparisonOperator" ); function match_ComparisonOperator ($stack = array()) {
$_99 = NULL; $matchrule = "ComparisonOperator"; $result = $this->construct($matchrule, $matchrule, null);
$_130 = NULL;
do { do {
$res_90 = $result; $res_123 = $result;
$pos_90 = $this->pos; $pos_123 = $this->pos;
$_91 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '==' ) ) !== FALSE) {
if (( $subres = $this->literal( $_91->expand("==") ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$_99 = TRUE; break; $_130 = TRUE; break;
} }
$result = $res_90; $result = $res_123;
$this->pos = $pos_90; $this->pos = $pos_123;
$_97 = NULL; $_128 = NULL;
do { do {
$res_93 = $result; $res_125 = $result;
$pos_93 = $this->pos; $pos_125 = $this->pos;
$_94 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '!=' ) ) !== FALSE) {
if (( $subres = $this->literal( $_94->expand("!=") ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$_97 = TRUE; break; $_128 = TRUE; break;
} }
$result = $res_93; $result = $res_125;
$this->pos = $pos_93; $this->pos = $pos_125;
if (substr($this->string,$this->pos,1) == "=") { if (substr($this->string,$this->pos,1) == '=') {
$this->pos += 1; $this->pos += 1;
$result["text"] .= "="; $result["text"] .= '=';
$_97 = TRUE; break; $_128 = TRUE; break;
} }
$result = $res_93; $result = $res_125;
$this->pos = $pos_93; $this->pos = $pos_125;
$_97 = FALSE; break; $_128 = FALSE; break;
} }
while(0); while(0);
if( $_97 === TRUE ) { $_99 = TRUE; break; } if( $_128 === TRUE ) { $_130 = TRUE; break; }
$result = $res_90; $result = $res_123;
$this->pos = $pos_90; $this->pos = $pos_123;
$_99 = FALSE; break; $_130 = FALSE; break;
} }
while(0); while(0);
if( $_99 === TRUE ) { if( $_130 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "ComparisonOperator", $result ); if( $_130 === FALSE) { return FALSE; }
}
if( $_99 === FALSE) { return FALSE; }
} }
/* Comparison: Argument < ComparisonOperator > Argument */ /* Comparison: Argument < ComparisonOperator > Argument */
function match_Comparison ($substack = array()) { protected $match_Comparison_typestack = array('Comparison');
$result = $this->construct( "Comparison" ); function match_Comparison ($stack = array()) {
$_106 = NULL; $matchrule = "Comparison"; $result = $this->construct($matchrule, $matchrule, null);
$_137 = NULL;
do { do {
$key = "Argument"; $pos = $this->pos; $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); } if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_106 = FALSE; break; } else { $_137 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "ComparisonOperator"; $pos = $this->pos; $matcher = 'match_'.'ComparisonOperator'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_ComparisonOperator(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); } if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_106 = FALSE; break; } else { $_137 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "Argument"; $pos = $this->pos; $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); } if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_106 = FALSE; break; } else { $_137 = FALSE; break; }
$_106 = TRUE; break; $_137 = TRUE; break;
} }
while(0); while(0);
if( $_106 === TRUE ) { if( $_137 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "Comparison", $result ); if( $_137 === FALSE) { return FALSE; }
}
if( $_106 === FALSE) { return FALSE; }
} }
function Comparison_Argument(&$res, $sub) { function Comparison_Argument(&$res, $sub) {
if ($sub['ArgumentMode'] == 'default') { 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 $res['php'] = str_replace('$$FINAL', 'XML_val', $sub['lookup_php']);
} }
else { else {
if (!isset($res['php'])) $res['php'] = '';
$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']); $res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']);
} }
} }
@ -784,56 +990,48 @@ class SSTemplateParser extends Parser {
} }
/* PresenceCheck: (Not:'not' <)? Argument */ /* PresenceCheck: (Not:'not' <)? Argument */
function match_PresenceCheck ($substack = array()) { protected $match_PresenceCheck_typestack = array('PresenceCheck');
$result = $this->construct( "PresenceCheck" ); function match_PresenceCheck ($stack = array()) {
$_115 = NULL; $matchrule = "PresenceCheck"; $result = $this->construct($matchrule, $matchrule, null);
$_144 = NULL;
do { do {
$res_113 = $result; $res_142 = $result;
$pos_113 = $this->pos; $pos_142 = $this->pos;
$_112 = NULL; $_141 = NULL;
do { do {
$substack[] = $result; $stack[] = $result; $result = $this->construct( $matchrule, "Not" );
$result = $this->construct( "Not" ); if (( $subres = $this->literal( 'not' ) ) !== FALSE) {
$_108 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_108->expand('not') ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$subres = $result ; $subres = $result; $result = array_pop($stack);
$result = array_pop( $substack ) ;
$this->store( $result, $subres, 'Not' ); $this->store( $result, $subres, 'Not' );
} }
else { else {
$result = array_pop( $substack ) ; $result = array_pop($stack);
$_112 = FALSE; break; $_141 = FALSE; break;
} }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_112 = TRUE; break; $_141 = TRUE; break;
} }
while(0); while(0);
if( $_112 === FALSE) { if( $_141 === FALSE) {
$result = $res_113; $result = $res_142;
$this->pos = $pos_113; $this->pos = $pos_142;
unset( $res_113 ); unset( $res_142 );
unset( $pos_113 ); unset( $pos_142 );
} }
$key = "Argument"; $pos = $this->pos; $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); } if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_115 = FALSE; break; } else { $_144 = FALSE; break; }
$_115 = TRUE; break; $_144 = TRUE; break;
} }
while(0); while(0);
if( $_115 === TRUE ) { if( $_144 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "PresenceCheck", $result ); if( $_144 === FALSE) { return FALSE; }
}
if( $_115 === FALSE) { return FALSE; }
} }
function PresenceCheck__construct(&$res) {
$res['php'] = '';
}
function PresenceCheck_Not(&$res, $sub) { function PresenceCheck_Not(&$res, $sub) {
$res['php'] = '!'; $res['php'] = '!';
} }
@ -851,35 +1049,34 @@ class SSTemplateParser extends Parser {
} }
/* IfArgumentPortion: Comparison | PresenceCheck */ /* IfArgumentPortion: Comparison | PresenceCheck */
function match_IfArgumentPortion ($substack = array()) { protected $match_IfArgumentPortion_typestack = array('IfArgumentPortion');
$result = $this->construct( "IfArgumentPortion" ); function match_IfArgumentPortion ($stack = array()) {
$_120 = NULL; $matchrule = "IfArgumentPortion"; $result = $this->construct($matchrule, $matchrule, null);
$_149 = NULL;
do { do {
$res_117 = $result; $res_146 = $result;
$pos_117 = $this->pos; $pos_146 = $this->pos;
$key = "Comparison"; $pos = $this->pos; $matcher = 'match_'.'Comparison'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Comparison(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_120 = TRUE; break; $_149 = TRUE; break;
} }
$result = $res_117; $result = $res_146;
$this->pos = $pos_117; $this->pos = $pos_146;
$key = "PresenceCheck"; $pos = $this->pos; $matcher = 'match_'.'PresenceCheck'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_PresenceCheck(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_120 = TRUE; break; $_149 = TRUE; break;
} }
$result = $res_117; $result = $res_146;
$this->pos = $pos_117; $this->pos = $pos_146;
$_120 = FALSE; break; $_149 = FALSE; break;
} }
while(0); while(0);
if( $_120 === TRUE ) { if( $_149 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "IfArgumentPortion", $result ); if( $_149 === FALSE) { return FALSE; }
}
if( $_120 === FALSE) { return FALSE; }
} }
@ -889,91 +1086,84 @@ class SSTemplateParser extends Parser {
} }
/* BooleanOperator: "||" | "&&" */ /* BooleanOperator: "||" | "&&" */
function match_BooleanOperator ($substack = array()) { protected $match_BooleanOperator_typestack = array('BooleanOperator');
$result = $this->construct( "BooleanOperator" ); function match_BooleanOperator ($stack = array()) {
$_127 = NULL; $matchrule = "BooleanOperator"; $result = $this->construct($matchrule, $matchrule, null);
$_154 = NULL;
do { do {
$res_122 = $result; $res_151 = $result;
$pos_122 = $this->pos; $pos_151 = $this->pos;
$_123 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '||' ) ) !== FALSE) {
if (( $subres = $this->literal( $_123->expand("||") ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$_127 = TRUE; break; $_154 = TRUE; break;
} }
$result = $res_122; $result = $res_151;
$this->pos = $pos_122; $this->pos = $pos_151;
$_125 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '&&' ) ) !== FALSE) {
if (( $subres = $this->literal( $_125->expand("&&") ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$_127 = TRUE; break; $_154 = TRUE; break;
} }
$result = $res_122; $result = $res_151;
$this->pos = $pos_122; $this->pos = $pos_151;
$_127 = FALSE; break; $_154 = FALSE; break;
} }
while(0); while(0);
if( $_127 === TRUE ) { if( $_154 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "BooleanOperator", $result ); if( $_154 === FALSE) { return FALSE; }
}
if( $_127 === FALSE) { return FALSE; }
} }
/* IfArgument: :IfArgumentPortion ( < :BooleanOperator < :IfArgumentPortion )* */ /* IfArgument: :IfArgumentPortion ( < :BooleanOperator < :IfArgumentPortion )* */
function match_IfArgument ($substack = array()) { protected $match_IfArgument_typestack = array('IfArgument');
$result = $this->construct( "IfArgument" ); function match_IfArgument ($stack = array()) {
$_136 = NULL; $matchrule = "IfArgument"; $result = $this->construct($matchrule, $matchrule, null);
$_163 = NULL;
do { do {
$key = "IfArgumentPortion"; $pos = $this->pos; $matcher = 'match_'.'IfArgumentPortion'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_IfArgumentPortion(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "IfArgumentPortion" ); $this->store( $result, $subres, "IfArgumentPortion" );
} }
else { $_136 = FALSE; break; } else { $_163 = FALSE; break; }
while (true) { while (true) {
$res_135 = $result; $res_162 = $result;
$pos_135 = $this->pos; $pos_162 = $this->pos;
$_134 = NULL; $_161 = NULL;
do { do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "BooleanOperator"; $pos = $this->pos; $matcher = 'match_'.'BooleanOperator'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_BooleanOperator(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "BooleanOperator" ); $this->store( $result, $subres, "BooleanOperator" );
} }
else { $_134 = FALSE; break; } else { $_161 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "IfArgumentPortion"; $pos = $this->pos; $matcher = 'match_'.'IfArgumentPortion'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_IfArgumentPortion(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "IfArgumentPortion" ); $this->store( $result, $subres, "IfArgumentPortion" );
} }
else { $_134 = FALSE; break; } else { $_161 = FALSE; break; }
$_134 = TRUE; break; $_161 = TRUE; break;
} }
while(0); while(0);
if( $_134 === FALSE) { if( $_161 === FALSE) {
$result = $res_135; $result = $res_162;
$this->pos = $pos_135; $this->pos = $pos_162;
unset( $res_135 ); unset( $res_162 );
unset( $pos_135 ); unset( $pos_162 );
break; break;
} }
} }
$_136 = TRUE; break; $_163 = TRUE; break;
} }
while(0); while(0);
if( $_136 === TRUE ) { if( $_163 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "IfArgument", $result ); if( $_163 === FALSE) { return FALSE; }
}
if( $_136 === FALSE) { return FALSE; }
} }
function IfArgument__construct(&$res){
$res['php'] = '';
}
function IfArgument_IfArgumentPortion(&$res, $sub) { function IfArgument_IfArgumentPortion(&$res, $sub) {
$res['php'] .= $sub['php']; $res['php'] .= $sub['php'];
} }
@ -982,177 +1172,161 @@ class SSTemplateParser extends Parser {
$res['php'] .= $sub['text']; $res['php'] .= $sub['text'];
} }
/* IfPart: '<%' < 'if' [ :IfArgument > '%>' :Template? */ /* IfPart: '<%' < 'if' [ :IfArgument > '%>' Template:$TemplateMatcher? */
function match_IfPart ($substack = array()) { protected $match_IfPart_typestack = array('IfPart');
$result = $this->construct( "IfPart" ); function match_IfPart ($stack = array()) {
$_149 = NULL; $matchrule = "IfPart"; $result = $this->construct($matchrule, $matchrule, null);
$_173 = NULL;
do { do {
$_138 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_138->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_173 = FALSE; break; }
else { $_149 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_141 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( 'if' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_141->expand('if') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_173 = FALSE; break; }
else { $_149 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_149 = FALSE; break; } else { $_173 = FALSE; break; }
$key = "IfArgument"; $pos = $this->pos; $matcher = 'match_'.'IfArgument'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_IfArgument(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "IfArgument" ); $this->store( $result, $subres, "IfArgument" );
} }
else { $_149 = FALSE; break; } else { $_173 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_146 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_146->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_173 = FALSE; break; }
else { $_149 = FALSE; break; } $res_172 = $result;
$res_148 = $result; $pos_172 = $this->pos;
$pos_148 = $this->pos; $matcher = 'match_'.$this->expression($result, $stack, 'TemplateMatcher'); $key = $matcher; $pos = $this->pos;
$key = "Template"; $pos = $this->pos; $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Template(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Template" ); $this->store( $result, $subres, "Template" );
} }
else { else {
$result = $res_148; $result = $res_172;
$this->pos = $pos_148; $this->pos = $pos_172;
unset( $res_148 ); unset( $res_172 );
unset( $pos_148 ); 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; $_173 = TRUE; break;
} }
while(0); while(0);
if( $_173 === TRUE ) { if( $_173 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "ElsePart", $result );
}
if( $_173 === FALSE) { return FALSE; } if( $_173 === FALSE) { return FALSE; }
} }
/* If: IfPart ElseIfPart* ElsePart? '<%' < 'end_if' > '%>' */ /* ElseIfPart: '<%' < 'else_if' [ :IfArgument > '%>' Template:$TemplateMatcher */
function match_If ($substack = array()) { protected $match_ElseIfPart_typestack = array('ElseIfPart');
$result = $this->construct( "If" ); function match_ElseIfPart ($stack = array()) {
$_186 = NULL; $matchrule = "ElseIfPart"; $result = $this->construct($matchrule, $matchrule, null);
$_183 = NULL;
do { do {
$key = "IfPart"; $pos = $this->pos; if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_IfPart(array_merge($substack, array($result))) ) ); 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 ); } if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_186 = FALSE; break; } else { $_201 = FALSE; break; }
while (true) { while (true) {
$res_176 = $result; $res_194 = $result;
$pos_176 = $this->pos; $pos_194 = $this->pos;
$key = "ElseIfPart"; $pos = $this->pos; $matcher = 'match_'.'ElseIfPart'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_ElseIfPart(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); } if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { else {
$result = $res_176; $result = $res_194;
$this->pos = $pos_176; $this->pos = $pos_194;
unset( $res_176 ); unset( $res_194 );
unset( $pos_176 ); unset( $pos_194 );
break; break;
} }
} }
$res_177 = $result; $res_195 = $result;
$pos_177 = $this->pos; $pos_195 = $this->pos;
$key = "ElsePart"; $pos = $this->pos; $matcher = 'match_'.'ElsePart'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_ElsePart(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); } if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { else {
$result = $res_177; $result = $res_195;
$this->pos = $pos_177; $this->pos = $pos_195;
unset( $res_177 ); unset( $res_195 );
unset( $pos_177 ); unset( $pos_195 );
} }
$_178 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_178->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_201 = FALSE; break; }
else { $_186 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_181 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( 'end_if' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_181->expand('end_if') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_201 = FALSE; break; }
else { $_186 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_184 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_184->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_201 = FALSE; break; }
else { $_186 = FALSE; break; } $_201 = TRUE; break;
$_186 = TRUE; break;
} }
while(0); while(0);
if( $_186 === TRUE ) { if( $_201 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "If", $result ); if( $_201 === FALSE) { return FALSE; }
}
if( $_186 === FALSE) { return FALSE; }
} }
@ -1179,70 +1353,64 @@ class SSTemplateParser extends Parser {
} }
/* Require: '<%' < 'require' [ Call:(Method:Word "(" < :CallArguments > ")") > '%>' */ /* Require: '<%' < 'require' [ Call:(Method:Word "(" < :CallArguments > ")") > '%>' */
function match_Require ($substack = array()) { protected $match_Require_typestack = array('Require');
$result = $this->construct( "Require" ); function match_Require ($stack = array()) {
$_206 = NULL; $matchrule = "Require"; $result = $this->construct($matchrule, $matchrule, null);
$_217 = NULL;
do { do {
$_188 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_188->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_217 = FALSE; break; }
else { $_206 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_191 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( 'require' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_191->expand('require') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_217 = FALSE; break; }
else { $_206 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_206 = FALSE; break; } else { $_217 = FALSE; break; }
$substack[] = $result; $stack[] = $result; $result = $this->construct( $matchrule, "Call" );
$result = $this->construct( "Call" ); $_213 = NULL;
$_200 = NULL;
do { do {
$key = "Word"; $pos = $this->pos; $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Method" ); $this->store( $result, $subres, "Method" );
} }
else { $_200 = FALSE; break; } else { $_213 = FALSE; break; }
if (substr($this->string,$this->pos,1) == "(") { if (substr($this->string,$this->pos,1) == '(') {
$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; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "CallArguments"; $pos = $this->pos; $matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_CallArguments(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "CallArguments" ); $this->store( $result, $subres, "CallArguments" );
} }
else { $_200 = FALSE; break; } else { $_213 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } 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; $this->pos += 1;
$result["text"] .= ")"; $result["text"] .= ')';
} }
else { $_200 = FALSE; break; } else { $_213 = FALSE; break; }
$_200 = TRUE; break; $_213 = TRUE; break;
} }
while(0); while(0);
if( $_200 === TRUE ) { if( $_213 === TRUE ) {
$subres = $result ; $subres = $result; $result = array_pop($stack);
$result = array_pop( $substack ) ;
$this->store( $result, $subres, 'Call' ); $this->store( $result, $subres, 'Call' );
} }
if( $_200 === FALSE) { if( $_213 === FALSE) {
$result = array_pop( $substack ) ; $result = array_pop($stack);
$_206 = FALSE; break; $_217 = FALSE; break;
} }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_204 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_204->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_217 = FALSE; break; }
else { $_206 = FALSE; break; } $_217 = TRUE; break;
$_206 = TRUE; break;
} }
while(0); while(0);
if( $_206 === TRUE ) { if( $_217 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "Require", $result ); if( $_217 === FALSE) { return FALSE; }
}
if( $_206 === FALSE) { return FALSE; }
} }
@ -1251,62 +1419,1066 @@ class SSTemplateParser extends Parser {
$res['php'] = "Requirements::".$sub['Method']['text'].'('.$sub['CallArguments']['php'].');'; $res['php'] = "Requirements::".$sub['Method']['text'].'('.$sub['CallArguments']['php'].');';
} }
/* OldTPart: "_t" < "(" < QuotedString (< "," < CallArguments)? > ")" */
function match_OldTPart ($substack = array()) { /* CacheBlockArgument:
$result = $this->construct( "OldTPart" ); !( "if " | "unless " )
$_222 = NULL; (
: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 { do {
$_208 = new ParserExpression( $this, $substack, $result ); $res_225 = $result;
if (( $subres = $this->literal( $_208->expand("_t") ) ) !== FALSE) { $result["text"] .= $subres; } $pos_225 = $this->pos;
else { $_222 = FALSE; break; } $_224 = NULL;
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;
do { do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } $_222 = NULL;
if (substr($this->string,$this->pos,1) == ",") { do {
$this->pos += 1; $res_219 = $result;
$result["text"] .= ","; $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; } while(0);
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if( $_222 === FALSE) { $_224 = FALSE; break; }
$key = "CallArguments"; $pos = $this->pos; $_224 = TRUE; break;
$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); while(0);
if( $_218 === FALSE) { if( $_224 === TRUE ) {
$result = $res_219; $result = $res_225;
$this->pos = $pos_219; $this->pos = $pos_225;
unset( $res_219 ); $_237 = FALSE; break;
unset( $pos_219 );
} }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if( $_224 === FALSE) {
if (substr($this->string,$this->pos,1) == ")") { $result = $res_225;
$this->pos += 1; $this->pos = $pos_225;
$result["text"] .= ")";
} }
else { $_222 = FALSE; break; } $_235 = NULL;
$_222 = TRUE; break; 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); while(0);
if( $_222 === TRUE ) { if( $_237 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "OldTPart", $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 > "%>" */ /* OldTTag: "<%" < OldTPart > "%>" */
function match_OldTTag ($substack = array()) { protected $match_OldTTag_typestack = array('OldTTag');
$result = $this->construct( "OldTTag" ); function match_OldTTag ($stack = array()) {
$_231 = NULL; $matchrule = "OldTTag"; $result = $this->construct($matchrule, $matchrule, null);
$_440 = NULL;
do { do {
$_224 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_224->expand("<%") ) ) !== FALSE) { $result["text"] .= $subres; } else { $_440 = FALSE; break; }
else { $_231 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "OldTPart"; $pos = $this->pos; $matcher = 'match_'.'OldTPart'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OldTPart(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); } if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_231 = FALSE; break; } else { $_440 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_229 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_229->expand("%>") ) ) !== FALSE) { $result["text"] .= $subres; } else { $_440 = FALSE; break; }
else { $_231 = FALSE; break; } $_440 = TRUE; break;
$_231 = TRUE; break;
} }
while(0); while(0);
if( $_231 === TRUE ) { if( $_440 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "OldTTag", $result ); if( $_440 === FALSE) { return FALSE; }
}
if( $_231 === FALSE) { return FALSE; }
} }
@ -1366,56 +2535,52 @@ class SSTemplateParser extends Parser {
} }
/* OldSprintfTag: "<%" < "sprintf" < "(" < OldTPart < "," < CallArguments > ")" > "%>" */ /* OldSprintfTag: "<%" < "sprintf" < "(" < OldTPart < "," < CallArguments > ")" > "%>" */
function match_OldSprintfTag ($substack = array()) { protected $match_OldSprintfTag_typestack = array('OldSprintfTag');
$result = $this->construct( "OldSprintfTag" ); function match_OldSprintfTag ($stack = array()) {
$_251 = NULL; $matchrule = "OldSprintfTag"; $result = $this->construct($matchrule, $matchrule, null);
$_457 = NULL;
do { do {
$_233 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_233->expand("<%") ) ) !== FALSE) { $result["text"] .= $subres; } else { $_457 = FALSE; break; }
else { $_251 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_236 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( 'sprintf' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_236->expand("sprintf") ) ) !== FALSE) { $result["text"] .= $subres; } else { $_457 = FALSE; break; }
else { $_251 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } 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; $this->pos += 1;
$result["text"] .= "("; $result["text"] .= '(';
} }
else { $_251 = FALSE; break; } else { $_457 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "OldTPart"; $pos = $this->pos; $matcher = 'match_'.'OldTPart'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OldTPart(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); } if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_251 = FALSE; break; } else { $_457 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } 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; $this->pos += 1;
$result["text"] .= ","; $result["text"] .= ',';
} }
else { $_251 = FALSE; break; } else { $_457 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "CallArguments"; $pos = $this->pos; $matcher = 'match_'.'CallArguments'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_CallArguments(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { $this->store( $result, $subres ); } if ($subres !== FALSE) { $this->store( $result, $subres ); }
else { $_251 = FALSE; break; } else { $_457 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } 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; $this->pos += 1;
$result["text"] .= ")"; $result["text"] .= ')';
} }
else { $_251 = FALSE; break; } else { $_457 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_249 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_249->expand("%>") ) ) !== FALSE) { $result["text"] .= $subres; } else { $_457 = FALSE; break; }
else { $_251 = FALSE; break; } $_457 = TRUE; break;
$_251 = TRUE; break;
} }
while(0); while(0);
if( $_251 === TRUE ) { if( $_457 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "OldSprintfTag", $result ); if( $_457 === FALSE) { return FALSE; }
}
if( $_251 === FALSE) { return FALSE; }
} }
@ -1433,35 +2598,34 @@ class SSTemplateParser extends Parser {
} }
/* OldI18NTag: OldSprintfTag | OldTTag */ /* OldI18NTag: OldSprintfTag | OldTTag */
function match_OldI18NTag ($substack = array()) { protected $match_OldI18NTag_typestack = array('OldI18NTag');
$result = $this->construct( "OldI18NTag" ); function match_OldI18NTag ($stack = array()) {
$_256 = NULL; $matchrule = "OldI18NTag"; $result = $this->construct($matchrule, $matchrule, null);
$_462 = NULL;
do { do {
$res_253 = $result; $res_459 = $result;
$pos_253 = $this->pos; $pos_459 = $this->pos;
$key = "OldSprintfTag"; $pos = $this->pos; $matcher = 'match_'.'OldSprintfTag'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OldSprintfTag(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_256 = TRUE; break; $_462 = TRUE; break;
} }
$result = $res_253; $result = $res_459;
$this->pos = $pos_253; $this->pos = $pos_459;
$key = "OldTTag"; $pos = $this->pos; $matcher = 'match_'.'OldTTag'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OldTTag(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_256 = TRUE; break; $_462 = TRUE; break;
} }
$result = $res_253; $result = $res_459;
$this->pos = $pos_253; $this->pos = $pos_459;
$_256 = FALSE; break; $_462 = FALSE; break;
} }
while(0); while(0);
if( $_256 === TRUE ) { if( $_462 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "OldI18NTag", $result ); if( $_462 === FALSE) { return FALSE; }
}
if( $_256 === FALSE) { return FALSE; }
} }
@ -1471,251 +2635,283 @@ class SSTemplateParser extends Parser {
} }
/* BlockArguments: :Argument ( < "," < :Argument)* */ /* BlockArguments: :Argument ( < "," < :Argument)* */
function match_BlockArguments ($substack = array()) { protected $match_BlockArguments_typestack = array('BlockArguments');
$result = $this->construct( "BlockArguments" ); function match_BlockArguments ($stack = array()) {
$_265 = NULL; $matchrule = "BlockArguments"; $result = $this->construct($matchrule, $matchrule, null);
$_471 = NULL;
do { do {
$key = "Argument"; $pos = $this->pos; $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Argument" ); $this->store( $result, $subres, "Argument" );
} }
else { $_265 = FALSE; break; } else { $_471 = FALSE; break; }
while (true) { while (true) {
$res_264 = $result; $res_470 = $result;
$pos_264 = $this->pos; $pos_470 = $this->pos;
$_263 = NULL; $_469 = NULL;
do { do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } 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; $this->pos += 1;
$result["text"] .= ","; $result["text"] .= ',';
} }
else { $_263 = FALSE; break; } else { $_469 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$key = "Argument"; $pos = $this->pos; $matcher = 'match_'.'Argument'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Argument(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Argument" ); $this->store( $result, $subres, "Argument" );
} }
else { $_263 = FALSE; break; } else { $_469 = FALSE; break; }
$_263 = TRUE; break; $_469 = TRUE; break;
} }
while(0); while(0);
if( $_263 === FALSE) { if( $_469 === FALSE) {
$result = $res_264; $result = $res_470;
$this->pos = $pos_264; $this->pos = $pos_470;
unset( $res_264 ); unset( $res_470 );
unset( $pos_264 ); unset( $pos_470 );
break; break;
} }
} }
$_265 = TRUE; break; $_471 = TRUE; break;
} }
while(0); while(0);
if( $_265 === TRUE ) { if( $_471 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "BlockArguments", $result ); if( $_471 === FALSE) { return FALSE; }
}
if( $_265 === FALSE) { return FALSE; }
} }
/* NotBlockTag: "end_" | (("if" | "else_if" | "else" | "require") ] ) */ /* NotBlockTag: "end_" | (("if" | "else_if" | "else" | "require" | "cached" | "uncached" | "cacheblock") ] ) */
function match_NotBlockTag ($substack = array()) { protected $match_NotBlockTag_typestack = array('NotBlockTag');
$result = $this->construct( "NotBlockTag" ); function match_NotBlockTag ($stack = array()) {
$_292 = NULL; $matchrule = "NotBlockTag"; $result = $this->construct($matchrule, $matchrule, null);
$_505 = NULL;
do { do {
$res_267 = $result; $res_473 = $result;
$pos_267 = $this->pos; $pos_473 = $this->pos;
$_268 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( 'end_' ) ) !== FALSE) {
if (( $subres = $this->literal( $_268->expand("end_") ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$_292 = TRUE; break; $_505 = TRUE; break;
} }
$result = $res_267; $result = $res_473;
$this->pos = $pos_267; $this->pos = $pos_473;
$_290 = NULL; $_503 = NULL;
do { do {
$_287 = NULL; $_500 = NULL;
do { do {
$_285 = NULL; $_498 = NULL;
do { do {
$res_270 = $result; $res_475 = $result;
$pos_270 = $this->pos; $pos_475 = $this->pos;
$_271 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( 'if' ) ) !== FALSE) {
if (( $subres = $this->literal( $_271->expand("if") ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$_285 = TRUE; break; $_498 = TRUE; break;
} }
$result = $res_270; $result = $res_475;
$this->pos = $pos_270; $this->pos = $pos_475;
$_283 = NULL; $_496 = NULL;
do { do {
$res_273 = $result; $res_477 = $result;
$pos_273 = $this->pos; $pos_477 = $this->pos;
$_274 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( 'else_if' ) ) !== FALSE) {
if (( $subres = $this->literal( $_274->expand("else_if") ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$_283 = TRUE; break; $_496 = TRUE; break;
} }
$result = $res_273; $result = $res_477;
$this->pos = $pos_273; $this->pos = $pos_477;
$_281 = NULL; $_494 = NULL;
do { do {
$res_276 = $result; $res_479 = $result;
$pos_276 = $this->pos; $pos_479 = $this->pos;
$_277 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( 'else' ) ) !== FALSE) {
if (( $subres = $this->literal( $_277->expand("else") ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$_281 = TRUE; break; $_494 = TRUE; break;
} }
$result = $res_276; $result = $res_479;
$this->pos = $pos_276; $this->pos = $pos_479;
$_279 = new ParserExpression( $this, $substack, $result ); $_492 = NULL;
if (( $subres = $this->literal( $_279->expand("require") ) ) !== FALSE) { do {
$result["text"] .= $subres; $res_481 = $result;
$_281 = TRUE; break; $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; while(0);
$this->pos = $pos_276; if( $_492 === TRUE ) { $_494 = TRUE; break; }
$_281 = FALSE; break; $result = $res_479;
$this->pos = $pos_479;
$_494 = FALSE; break;
} }
while(0); while(0);
if( $_281 === TRUE ) { $_283 = TRUE; break; } if( $_494 === TRUE ) { $_496 = TRUE; break; }
$result = $res_273; $result = $res_477;
$this->pos = $pos_273; $this->pos = $pos_477;
$_283 = FALSE; break; $_496 = FALSE; break;
} }
while(0); while(0);
if( $_283 === TRUE ) { $_285 = TRUE; break; } if( $_496 === TRUE ) { $_498 = TRUE; break; }
$result = $res_270; $result = $res_475;
$this->pos = $pos_270; $this->pos = $pos_475;
$_285 = FALSE; break; $_498 = FALSE; break;
} }
while(0); while(0);
if( $_285 === FALSE) { $_287 = FALSE; break; } if( $_498 === FALSE) { $_500 = FALSE; break; }
$_287 = TRUE; break; $_500 = TRUE; break;
} }
while(0); while(0);
if( $_287 === FALSE) { $_290 = FALSE; break; } if( $_500 === FALSE) { $_503 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_290 = FALSE; break; } else { $_503 = FALSE; break; }
$_290 = TRUE; break; $_503 = TRUE; break;
} }
while(0); while(0);
if( $_290 === TRUE ) { $_292 = TRUE; break; } if( $_503 === TRUE ) { $_505 = TRUE; break; }
$result = $res_267; $result = $res_473;
$this->pos = $pos_267; $this->pos = $pos_473;
$_292 = FALSE; break; $_505 = FALSE; break;
} }
while(0); while(0);
if( $_292 === TRUE ) { if( $_505 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "NotBlockTag", $result ); if( $_505 === FALSE) { return FALSE; }
}
if( $_292 === FALSE) { return FALSE; }
} }
/* ClosedBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > Zap:'%>' :Template? '<%' < 'end_' '$BlockName' > '%>' */ /* ClosedBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > Zap:'%>' Template:$TemplateMatcher? '<%' < 'end_' '$BlockName' > '%>' */
function match_ClosedBlock ($substack = array()) { protected $match_ClosedBlock_typestack = array('ClosedBlock');
$result = $this->construct( "ClosedBlock" ); function match_ClosedBlock ($stack = array()) {
$_319 = NULL; $matchrule = "ClosedBlock"; $result = $this->construct($matchrule, $matchrule, null);
$_525 = NULL;
do { do {
$_294 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_294->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_525 = FALSE; break; }
else { $_319 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$res_297 = $result; $res_509 = $result;
$pos_297 = $this->pos; $pos_509 = $this->pos;
$key = "NotBlockTag"; $pos = $this->pos; $matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_NotBlockTag(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$result = $res_297; $result = $res_509;
$this->pos = $pos_297; $this->pos = $pos_509;
$_319 = FALSE; break; $_525 = FALSE; break;
} }
else { else {
$result = $res_297; $result = $res_509;
$this->pos = $pos_297; $this->pos = $pos_509;
} }
$key = "Word"; $pos = $this->pos; $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "BlockName" ); $this->store( $result, $subres, "BlockName" );
} }
else { $_319 = FALSE; break; } else { $_525 = FALSE; break; }
$res_303 = $result; $res_515 = $result;
$pos_303 = $this->pos; $pos_515 = $this->pos;
$_302 = NULL; $_514 = NULL;
do { do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_302 = FALSE; break; } else { $_514 = FALSE; break; }
$key = "BlockArguments"; $pos = $this->pos; $matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_BlockArguments(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "BlockArguments" ); $this->store( $result, $subres, "BlockArguments" );
} }
else { $_302 = FALSE; break; } else { $_514 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_302 = FALSE; break; } else { $_514 = FALSE; break; }
$_302 = TRUE; break; $_514 = TRUE; break;
} }
while(0); while(0);
if( $_302 === FALSE) { if( $_514 === FALSE) {
$result = $res_303; $result = $res_515;
$this->pos = $pos_303; $this->pos = $pos_515;
unset( $res_303 ); unset( $res_515 );
unset( $pos_303 ); unset( $pos_515 );
} }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$substack[] = $result; $stack[] = $result; $result = $this->construct( $matchrule, "Zap" );
$result = $this->construct( "Zap" ); if (( $subres = $this->literal( '%>' ) ) !== FALSE) {
$_305 = new ParserExpression( $this, $substack, $result );
if (( $subres = $this->literal( $_305->expand('%>') ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$subres = $result ; $subres = $result; $result = array_pop($stack);
$result = array_pop( $substack ) ;
$this->store( $result, $subres, 'Zap' ); $this->store( $result, $subres, 'Zap' );
} }
else { else {
$result = array_pop( $substack ) ; $result = array_pop($stack);
$_319 = FALSE; break; $_525 = FALSE; break;
} }
$res_308 = $result; $res_518 = $result;
$pos_308 = $this->pos; $pos_518 = $this->pos;
$key = "Template"; $pos = $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->match_Template(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Template" ); $this->store( $result, $subres, "Template" );
} }
else { else {
$result = $res_308; $result = $res_518;
$this->pos = $pos_308; $this->pos = $pos_518;
unset( $res_308 ); unset( $res_518 );
unset( $pos_308 ); unset( $pos_518 );
} }
$_309 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_309->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_525 = FALSE; break; }
else { $_319 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_312 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_312->expand('end_') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_525 = FALSE; break; }
else { $_319 = FALSE; break; } if (( $subres = $this->literal( ''.$this->expression($result, $stack, 'BlockName').'' ) ) !== FALSE) { $result["text"] .= $subres; }
$_314 = new ParserExpression( $this, $substack, $result ); else { $_525 = FALSE; break; }
if (( $subres = $this->literal( $_314->expand('$BlockName') ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_319 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_317 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_317->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_525 = FALSE; break; }
else { $_319 = FALSE; break; } $_525 = TRUE; break;
$_319 = TRUE; break;
} }
while(0); while(0);
if( $_319 === TRUE ) { if( $_525 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "ClosedBlock", $result ); if( $_525 === FALSE) { return FALSE; }
}
if( $_319 === FALSE) { return FALSE; }
} }
@ -1809,68 +3005,65 @@ class SSTemplateParser extends Parser {
} }
/* OpenBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > '%>' */ /* OpenBlock: '<%' < !NotBlockTag BlockName:Word ( [ :BlockArguments ] )? > '%>' */
function match_OpenBlock ($substack = array()) { protected $match_OpenBlock_typestack = array('OpenBlock');
$result = $this->construct( "OpenBlock" ); function match_OpenBlock ($stack = array()) {
$_334 = NULL; $matchrule = "OpenBlock"; $result = $this->construct($matchrule, $matchrule, null);
$_538 = NULL;
do { do {
$_321 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_321->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_538 = FALSE; break; }
else { $_334 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$res_324 = $result; $res_529 = $result;
$pos_324 = $this->pos; $pos_529 = $this->pos;
$key = "NotBlockTag"; $pos = $this->pos; $matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_NotBlockTag(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$result = $res_324; $result = $res_529;
$this->pos = $pos_324; $this->pos = $pos_529;
$_334 = FALSE; break; $_538 = FALSE; break;
} }
else { else {
$result = $res_324; $result = $res_529;
$this->pos = $pos_324; $this->pos = $pos_529;
} }
$key = "Word"; $pos = $this->pos; $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "BlockName" ); $this->store( $result, $subres, "BlockName" );
} }
else { $_334 = FALSE; break; } else { $_538 = FALSE; break; }
$res_330 = $result; $res_535 = $result;
$pos_330 = $this->pos; $pos_535 = $this->pos;
$_329 = NULL; $_534 = NULL;
do { do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_329 = FALSE; break; } else { $_534 = FALSE; break; }
$key = "BlockArguments"; $pos = $this->pos; $matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_BlockArguments(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "BlockArguments" ); $this->store( $result, $subres, "BlockArguments" );
} }
else { $_329 = FALSE; break; } else { $_534 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_329 = FALSE; break; } else { $_534 = FALSE; break; }
$_329 = TRUE; break; $_534 = TRUE; break;
} }
while(0); while(0);
if( $_329 === FALSE) { if( $_534 === FALSE) {
$result = $res_330; $result = $res_535;
$this->pos = $pos_330; $this->pos = $pos_535;
unset( $res_330 ); unset( $res_535 );
unset( $pos_330 ); unset( $pos_535 );
} }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_332 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_332->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_538 = FALSE; break; }
else { $_334 = FALSE; break; } $_538 = TRUE; break;
$_334 = TRUE; break;
} }
while(0); while(0);
if( $_334 === TRUE ) { if( $_538 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "OpenBlock", $result ); if( $_538 === FALSE) { return FALSE; }
}
if( $_334 === FALSE) { return FALSE; }
} }
@ -1955,33 +3148,31 @@ class SSTemplateParser extends Parser {
return '$val .= $_SERVER[SCRIPT_URL];'; return '$val .= $_SERVER[SCRIPT_URL];';
} }
/* MismatchedEndBlock: '<%' < 'end_' Word > '%>' */ /* MismatchedEndBlock: '<%' < 'end_' :Word > '%>' */
function match_MismatchedEndBlock ($substack = array()) { protected $match_MismatchedEndBlock_typestack = array('MismatchedEndBlock');
$result = $this->construct( "MismatchedEndBlock" ); function match_MismatchedEndBlock ($stack = array()) {
$_345 = NULL; $matchrule = "MismatchedEndBlock"; $result = $this->construct($matchrule, $matchrule, null);
$_546 = NULL;
do { do {
$_336 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_336->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_546 = FALSE; break; }
else { $_345 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_339 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_339->expand('end_') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_546 = FALSE; break; }
else { $_345 = FALSE; break; } $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
$key = "Word"; $pos = $this->pos; $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) ); if ($subres !== FALSE) {
if ($subres !== FALSE) { $this->store( $result, $subres ); } $this->store( $result, $subres, "Word" );
else { $_345 = FALSE; break; } }
else { $_546 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_343 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_343->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_546 = FALSE; break; }
else { $_345 = FALSE; break; } $_546 = TRUE; break;
$_345 = TRUE; break;
} }
while(0); while(0);
if( $_345 === TRUE ) { if( $_546 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "MismatchedEndBlock", $result ); if( $_546 === FALSE) { return FALSE; }
}
if( $_345 === FALSE) { return FALSE; }
} }
@ -1992,84 +3183,81 @@ class SSTemplateParser extends Parser {
} }
/* MalformedOpenTag: '<%' < !NotBlockTag Tag:Word !( ( [ :BlockArguments ] )? > '%>' ) */ /* MalformedOpenTag: '<%' < !NotBlockTag Tag:Word !( ( [ :BlockArguments ] )? > '%>' ) */
function match_MalformedOpenTag ($substack = array()) { protected $match_MalformedOpenTag_typestack = array('MalformedOpenTag');
$result = $this->construct( "MalformedOpenTag" ); function match_MalformedOpenTag ($stack = array()) {
$_362 = NULL; $matchrule = "MalformedOpenTag"; $result = $this->construct($matchrule, $matchrule, null);
$_561 = NULL;
do { do {
$_347 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_347->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_561 = FALSE; break; }
else { $_362 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$res_350 = $result; $res_550 = $result;
$pos_350 = $this->pos; $pos_550 = $this->pos;
$key = "NotBlockTag"; $pos = $this->pos; $matcher = 'match_'.'NotBlockTag'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_NotBlockTag(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$result = $res_350; $result = $res_550;
$this->pos = $pos_350; $this->pos = $pos_550;
$_362 = FALSE; break; $_561 = FALSE; break;
} }
else { else {
$result = $res_350; $result = $res_550;
$this->pos = $pos_350; $this->pos = $pos_550;
} }
$key = "Word"; $pos = $this->pos; $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Tag" ); $this->store( $result, $subres, "Tag" );
} }
else { $_362 = FALSE; break; } else { $_561 = FALSE; break; }
$res_361 = $result; $res_560 = $result;
$pos_361 = $this->pos; $pos_560 = $this->pos;
$_360 = NULL; $_559 = NULL;
do { do {
$res_356 = $result; $res_556 = $result;
$pos_356 = $this->pos; $pos_556 = $this->pos;
$_355 = NULL; $_555 = NULL;
do { do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_355 = FALSE; break; } else { $_555 = FALSE; break; }
$key = "BlockArguments"; $pos = $this->pos; $matcher = 'match_'.'BlockArguments'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_BlockArguments(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "BlockArguments" ); $this->store( $result, $subres, "BlockArguments" );
} }
else { $_355 = FALSE; break; } else { $_555 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
else { $_355 = FALSE; break; } else { $_555 = FALSE; break; }
$_355 = TRUE; break; $_555 = TRUE; break;
} }
while(0); while(0);
if( $_355 === FALSE) { if( $_555 === FALSE) {
$result = $res_356; $result = $res_556;
$this->pos = $pos_356; $this->pos = $pos_556;
unset( $res_356 ); unset( $res_556 );
unset( $pos_356 ); unset( $pos_556 );
} }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_358 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_358->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_559 = FALSE; break; }
else { $_360 = FALSE; break; } $_559 = TRUE; break;
$_360 = TRUE; break;
} }
while(0); while(0);
if( $_360 === TRUE ) { if( $_559 === TRUE ) {
$result = $res_361; $result = $res_560;
$this->pos = $pos_361; $this->pos = $pos_560;
$_362 = FALSE; break; $_561 = FALSE; break;
} }
if( $_360 === FALSE) { if( $_559 === FALSE) {
$result = $res_361; $result = $res_560;
$this->pos = $pos_361; $this->pos = $pos_560;
} }
$_362 = TRUE; break; $_561 = TRUE; break;
} }
while(0); while(0);
if( $_362 === TRUE ) { if( $_561 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "MalformedOpenTag", $result ); if( $_561 === FALSE) { return FALSE; }
}
if( $_362 === FALSE) { return FALSE; }
} }
@ -2080,66 +3268,60 @@ class SSTemplateParser extends Parser {
} }
/* MalformedCloseTag: '<%' < Tag:('end_' :Word ) !( > '%>' ) */ /* MalformedCloseTag: '<%' < Tag:('end_' :Word ) !( > '%>' ) */
function match_MalformedCloseTag ($substack = array()) { protected $match_MalformedCloseTag_typestack = array('MalformedCloseTag');
$result = $this->construct( "MalformedCloseTag" ); function match_MalformedCloseTag ($stack = array()) {
$_378 = NULL; $matchrule = "MalformedCloseTag"; $result = $this->construct($matchrule, $matchrule, null);
$_573 = NULL;
do { do {
$_364 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '<%' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_364->expand('<%') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_573 = FALSE; break; }
else { $_378 = FALSE; break; }
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$substack[] = $result; $stack[] = $result; $result = $this->construct( $matchrule, "Tag" );
$result = $this->construct( "Tag" ); $_567 = NULL;
$_370 = NULL;
do { do {
$_367 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( 'end_' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_367->expand('end_') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_567 = FALSE; break; }
else { $_370 = FALSE; break; } $matcher = 'match_'.'Word'; $key = $matcher; $pos = $this->pos;
$key = "Word"; $pos = $this->pos; $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Word(array_merge($substack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres, "Word" ); $this->store( $result, $subres, "Word" );
} }
else { $_370 = FALSE; break; } else { $_567 = FALSE; break; }
$_370 = TRUE; break; $_567 = TRUE; break;
} }
while(0); while(0);
if( $_370 === TRUE ) { if( $_567 === TRUE ) {
$subres = $result ; $subres = $result; $result = array_pop($stack);
$result = array_pop( $substack ) ;
$this->store( $result, $subres, 'Tag' ); $this->store( $result, $subres, 'Tag' );
} }
if( $_370 === FALSE) { if( $_567 === FALSE) {
$result = array_pop( $substack ) ; $result = array_pop($stack);
$_378 = FALSE; break; $_573 = FALSE; break;
} }
$res_377 = $result; $res_572 = $result;
$pos_377 = $this->pos; $pos_572 = $this->pos;
$_376 = NULL; $_571 = NULL;
do { do {
if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; } if (( $subres = $this->whitespace( ) ) !== FALSE) { $result["text"] .= $subres; }
$_374 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '%>' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_374->expand('%>') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_571 = FALSE; break; }
else { $_376 = FALSE; break; } $_571 = TRUE; break;
$_376 = TRUE; break;
} }
while(0); while(0);
if( $_376 === TRUE ) { if( $_571 === TRUE ) {
$result = $res_377; $result = $res_572;
$this->pos = $pos_377; $this->pos = $pos_572;
$_378 = FALSE; break; $_573 = FALSE; break;
} }
if( $_376 === FALSE) { if( $_571 === FALSE) {
$result = $res_377; $result = $res_572;
$this->pos = $pos_377; $this->pos = $pos_572;
} }
$_378 = TRUE; break; $_573 = TRUE; break;
} }
while(0); while(0);
if( $_378 === TRUE ) { if( $_573 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "MalformedCloseTag", $result ); if( $_573 === FALSE) { return FALSE; }
}
if( $_378 === FALSE) { return FALSE; }
} }
@ -2150,94 +3332,88 @@ class SSTemplateParser extends Parser {
} }
/* MalformedBlock: MalformedOpenTag | MalformedCloseTag */ /* MalformedBlock: MalformedOpenTag | MalformedCloseTag */
function match_MalformedBlock ($substack = array()) { protected $match_MalformedBlock_typestack = array('MalformedBlock');
$result = $this->construct( "MalformedBlock" ); function match_MalformedBlock ($stack = array()) {
$_383 = NULL; $matchrule = "MalformedBlock"; $result = $this->construct($matchrule, $matchrule, null);
$_578 = NULL;
do { do {
$res_380 = $result; $res_575 = $result;
$pos_380 = $this->pos; $pos_575 = $this->pos;
$key = "MalformedOpenTag"; $pos = $this->pos; $matcher = 'match_'.'MalformedOpenTag'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_MalformedOpenTag(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_383 = TRUE; break; $_578 = TRUE; break;
} }
$result = $res_380; $result = $res_575;
$this->pos = $pos_380; $this->pos = $pos_575;
$key = "MalformedCloseTag"; $pos = $this->pos; $matcher = 'match_'.'MalformedCloseTag'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_MalformedCloseTag(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_383 = TRUE; break; $_578 = TRUE; break;
} }
$result = $res_380; $result = $res_575;
$this->pos = $pos_380; $this->pos = $pos_575;
$_383 = FALSE; break; $_578 = FALSE; break;
} }
while(0); while(0);
if( $_383 === TRUE ) { if( $_578 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "MalformedBlock", $result ); if( $_578 === FALSE) { return FALSE; }
}
if( $_383 === FALSE) { return FALSE; }
} }
/* Comment: "<%--" (!"--%>" /./)+ "--%>" */ /* Comment: "<%--" (!"--%>" /./)+ "--%>" */
function match_Comment ($substack = array()) { protected $match_Comment_typestack = array('Comment');
$result = $this->construct( "Comment" ); function match_Comment ($stack = array()) {
$_395 = NULL; $matchrule = "Comment"; $result = $this->construct($matchrule, $matchrule, null);
$_586 = NULL;
do { do {
$_385 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '<%--' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_385->expand("<%--") ) ) !== FALSE) { $result["text"] .= $subres; } else { $_586 = FALSE; break; }
else { $_395 = FALSE; break; }
$count = 0; $count = 0;
while (true) { while (true) {
$res_392 = $result; $res_584 = $result;
$pos_392 = $this->pos; $pos_584 = $this->pos;
$_391 = NULL; $_583 = NULL;
do { do {
$res_388 = $result; $res_581 = $result;
$pos_388 = $this->pos; $pos_581 = $this->pos;
$_387 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '--%>' ) ) !== FALSE) {
if (( $subres = $this->literal( $_387->expand("--%>") ) ) !== FALSE) {
$result["text"] .= $subres; $result["text"] .= $subres;
$result = $res_388; $result = $res_581;
$this->pos = $pos_388; $this->pos = $pos_581;
$_391 = FALSE; break; $_583 = FALSE; break;
} }
else { else {
$result = $res_388; $result = $res_581;
$this->pos = $pos_388; $this->pos = $pos_581;
} }
$_389 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->rx( '/./' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->rx( $_389->expand('/./') ) ) !== FALSE) { $result["text"] .= $subres; } else { $_583 = FALSE; break; }
else { $_391 = FALSE; break; } $_583 = TRUE; break;
$_391 = TRUE; break;
} }
while(0); while(0);
if( $_391 === FALSE) { if( $_583 === FALSE) {
$result = $res_392; $result = $res_584;
$this->pos = $pos_392; $this->pos = $pos_584;
unset( $res_392 ); unset( $res_584 );
unset( $pos_392 ); unset( $pos_584 );
break; break;
} }
$count += 1; $count += 1;
} }
if ($count > 0) { } if ($count > 0) { }
else { $_395 = FALSE; break; } else { $_586 = FALSE; break; }
$_393 = new ParserExpression( $this, $substack, $result ); if (( $subres = $this->literal( '--%>' ) ) !== FALSE) { $result["text"] .= $subres; }
if (( $subres = $this->literal( $_393->expand("--%>") ) ) !== FALSE) { $result["text"] .= $subres; } else { $_586 = FALSE; break; }
else { $_395 = FALSE; break; } $_586 = TRUE; break;
$_395 = TRUE; break;
} }
while(0); while(0);
if( $_395 === TRUE ) { if( $_586 === TRUE ) { return $this->finalise($result); }
return $this->finalise( "Comment", $result ); if( $_586 === FALSE) { return FALSE; }
}
if( $_395 === FALSE) { return FALSE; }
} }
@ -2246,221 +3422,284 @@ class SSTemplateParser extends Parser {
$res['php'] = ''; $res['php'] = '';
} }
/* Text: / /* TopTemplate: (Comment | If | Require | CacheBlock | UncachedBlock | OldI18NTag | ClosedBlock | OpenBlock | MalformedBlock | MismatchedEndBlock | Injection | Text)+ */
( protected $match_TopTemplate_typestack = array('TopTemplate','Template');
(\\.) | # Any escaped character function match_TopTemplate ($stack = array()) {
([^<${]) | # Any character that isn't <, $ or { $matchrule = "TopTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'Template'));
(<[^%]) | # < 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; $count = 0;
while (true) { while (true) {
$res_433 = $result; $res_634 = $result;
$pos_433 = $this->pos; $pos_634 = $this->pos;
$_432 = NULL; $_633 = NULL;
do { do {
$_430 = NULL; $_631 = NULL;
do { do {
$res_399 = $result; $res_588 = $result;
$pos_399 = $this->pos; $pos_588 = $this->pos;
$key = "Comment"; $pos = $this->pos; $matcher = 'match_'.'Comment'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Comment(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_430 = TRUE; break; $_631 = TRUE; break;
} }
$result = $res_399; $result = $res_588;
$this->pos = $pos_399; $this->pos = $pos_588;
$_428 = NULL; $_629 = NULL;
do { do {
$res_401 = $result; $res_590 = $result;
$pos_401 = $this->pos; $pos_590 = $this->pos;
$key = "If"; $pos = $this->pos; $matcher = 'match_'.'If'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_If(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_428 = TRUE; break; $_629 = TRUE; break;
} }
$result = $res_401; $result = $res_590;
$this->pos = $pos_401; $this->pos = $pos_590;
$_426 = NULL; $_627 = NULL;
do { do {
$res_403 = $result; $res_592 = $result;
$pos_403 = $this->pos; $pos_592 = $this->pos;
$key = "Require"; $pos = $this->pos; $matcher = 'match_'.'Require'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Require(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_426 = TRUE; break; $_627 = TRUE; break;
} }
$result = $res_403; $result = $res_592;
$this->pos = $pos_403; $this->pos = $pos_592;
$_424 = NULL; $_625 = NULL;
do { do {
$res_405 = $result; $res_594 = $result;
$pos_405 = $this->pos; $pos_594 = $this->pos;
$key = "OldI18NTag"; $pos = $this->pos; $matcher = 'match_'.'CacheBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OldI18NTag(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_424 = TRUE; break; $_625 = TRUE; break;
} }
$result = $res_405; $result = $res_594;
$this->pos = $pos_405; $this->pos = $pos_594;
$_422 = NULL; $_623 = NULL;
do { do {
$res_407 = $result; $res_596 = $result;
$pos_407 = $this->pos; $pos_596 = $this->pos;
$key = "ClosedBlock"; $pos = $this->pos; $matcher = 'match_'.'UncachedBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_ClosedBlock(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_422 = TRUE; break; $_623 = TRUE; break;
} }
$result = $res_407; $result = $res_596;
$this->pos = $pos_407; $this->pos = $pos_596;
$_420 = NULL; $_621 = NULL;
do { do {
$res_409 = $result; $res_598 = $result;
$pos_409 = $this->pos; $pos_598 = $this->pos;
$key = "OpenBlock"; $pos = $this->pos; $matcher = 'match_'.'OldI18NTag'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_OpenBlock(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_420 = TRUE; break; $_621 = TRUE; break;
} }
$result = $res_409; $result = $res_598;
$this->pos = $pos_409; $this->pos = $pos_598;
$_418 = NULL; $_619 = NULL;
do { do {
$res_411 = $result; $res_600 = $result;
$pos_411 = $this->pos; $pos_600 = $this->pos;
$key = "MalformedBlock"; $pos = $this->pos; $matcher = 'match_'.'ClosedBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_MalformedBlock(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_418 = TRUE; break; $_619 = TRUE; break;
} }
$result = $res_411; $result = $res_600;
$this->pos = $pos_411; $this->pos = $pos_600;
$_416 = NULL; $_617 = NULL;
do { do {
$res_413 = $result; $res_602 = $result;
$pos_413 = $this->pos; $pos_602 = $this->pos;
$key = "Injection"; $pos = $this->pos; $matcher = 'match_'.'OpenBlock'; $key = $matcher; $pos = $this->pos;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Injection(array_merge($substack, array($result))) ) ); $subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
if ($subres !== FALSE) { if ($subres !== FALSE) {
$this->store( $result, $subres ); $this->store( $result, $subres );
$_416 = TRUE; break; $_617 = TRUE; break;
} }
$result = $res_413; $result = $res_602;
$this->pos = $pos_413; $this->pos = $pos_602;
$key = "Text"; $pos = $this->pos; $_615 = NULL;
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->match_Text(array_merge($substack, array($result))) ) ); do {
if ($subres !== FALSE) { $res_604 = $result;
$this->store( $result, $subres ); $pos_604 = $this->pos;
$_416 = TRUE; break; $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 );
$_615 = 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;
}
while(0);
if( $_613 === TRUE ) { $_615 = TRUE; break; }
$result = $res_604;
$this->pos = $pos_604;
$_615 = FALSE; break;
} }
$result = $res_413; while(0);
$this->pos = $pos_413; if( $_615 === TRUE ) { $_617 = TRUE; break; }
$_416 = FALSE; break; $result = $res_602;
$this->pos = $pos_602;
$_617 = FALSE; break;
} }
while(0); while(0);
if( $_416 === TRUE ) { $_418 = TRUE; break; } if( $_617 === TRUE ) { $_619 = TRUE; break; }
$result = $res_411; $result = $res_600;
$this->pos = $pos_411; $this->pos = $pos_600;
$_418 = FALSE; break; $_619 = FALSE; break;
} }
while(0); while(0);
if( $_418 === TRUE ) { $_420 = TRUE; break; } if( $_619 === TRUE ) { $_621 = TRUE; break; }
$result = $res_409; $result = $res_598;
$this->pos = $pos_409; $this->pos = $pos_598;
$_420 = FALSE; break; $_621 = FALSE; break;
} }
while(0); while(0);
if( $_420 === TRUE ) { $_422 = TRUE; break; } if( $_621 === TRUE ) { $_623 = TRUE; break; }
$result = $res_407; $result = $res_596;
$this->pos = $pos_407; $this->pos = $pos_596;
$_422 = FALSE; break; $_623 = FALSE; break;
} }
while(0); while(0);
if( $_422 === TRUE ) { $_424 = TRUE; break; } if( $_623 === TRUE ) { $_625 = TRUE; break; }
$result = $res_405; $result = $res_594;
$this->pos = $pos_405; $this->pos = $pos_594;
$_424 = FALSE; break; $_625 = FALSE; break;
} }
while(0); while(0);
if( $_424 === TRUE ) { $_426 = TRUE; break; } if( $_625 === TRUE ) { $_627 = TRUE; break; }
$result = $res_403; $result = $res_592;
$this->pos = $pos_403; $this->pos = $pos_592;
$_426 = FALSE; break; $_627 = FALSE; break;
} }
while(0); while(0);
if( $_426 === TRUE ) { $_428 = TRUE; break; } if( $_627 === TRUE ) { $_629 = TRUE; break; }
$result = $res_401; $result = $res_590;
$this->pos = $pos_401; $this->pos = $pos_590;
$_428 = FALSE; break; $_629 = FALSE; break;
} }
while(0); while(0);
if( $_428 === TRUE ) { $_430 = TRUE; break; } if( $_629 === TRUE ) { $_631 = TRUE; break; }
$result = $res_399; $result = $res_588;
$this->pos = $pos_399; $this->pos = $pos_588;
$_430 = FALSE; break; $_631 = FALSE; break;
} }
while(0); while(0);
if( $_430 === FALSE) { $_432 = FALSE; break; } if( $_631 === FALSE) { $_633 = FALSE; break; }
$_432 = TRUE; break; $_633 = TRUE; break;
} }
while(0); while(0);
if( $_432 === FALSE) { if( $_633 === FALSE) {
$result = $res_433; $result = $res_634;
$this->pos = $pos_433; $this->pos = $pos_634;
unset( $res_433 ); unset( $res_634 );
unset( $pos_433 ); unset( $pos_634 );
break; break;
} }
$count += 1; $count += 1;
} }
if ($count > 0) { if ($count > 0) { return $this->finalise($result); }
return $this->finalise( "Template", $result ); else { return FALSE; }
}
/**
* The TopTemplate also includes the opening stanza to start off the template
*/
function TopTemplate__construct(&$res) {
$res['php'] = "<?php" . PHP_EOL;
}
/* 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; } else { return FALSE; }
} }
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( $text = preg_replace(
'/href\s*\=\s*\"\#/', '/href\s*\=\s*\"\#/',
'href="<?= SSViewer::{dlr}options[\'rewriteHashlinks\'] ? Convert::raw2att( {dlr}_SERVER[\'REQUEST_URI\'] ) : "" ?>#', 'href="<?= SSViewer::{dlr}options[\'rewriteHashlinks\'] ? Convert::raw2att( {dlr}_SERVER[\'REQUEST_URI\'] ) : "" ?>#',
@ -2476,222 +3715,6 @@ class SSTemplateParser extends Parser {
'SSVIEWER;' . 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" );
$count = 0;
while (true) {
$res_472 = $result;
$pos_472 = $this->pos;
$_471 = NULL;
do {
$_469 = 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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_469 = TRUE; break;
}
$result = $res_434;
$this->pos = $pos_434;
$_467 = 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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_467 = TRUE; break;
}
$result = $res_436;
$this->pos = $pos_436;
$_465 = 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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_465 = TRUE; break;
}
$result = $res_438;
$this->pos = $pos_438;
$_463 = 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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_463 = TRUE; break;
}
$result = $res_440;
$this->pos = $pos_440;
$_461 = 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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_461 = TRUE; break;
}
$result = $res_442;
$this->pos = $pos_442;
$_459 = 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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_459 = TRUE; break;
}
$result = $res_444;
$this->pos = $pos_444;
$_457 = 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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_457 = TRUE; break;
}
$result = $res_446;
$this->pos = $pos_446;
$_455 = 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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_455 = TRUE; break;
}
$result = $res_448;
$this->pos = $pos_448;
$_453 = 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))) ) );
if ($subres !== FALSE) {
$this->store( $result, $subres );
$_453 = 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_450;
$this->pos = $pos_450;
$_453 = FALSE; break;
}
while(0);
if( $_453 === TRUE ) { $_455 = TRUE; break; }
$result = $res_448;
$this->pos = $pos_448;
$_455 = FALSE; break;
}
while(0);
if( $_455 === TRUE ) { $_457 = TRUE; break; }
$result = $res_446;
$this->pos = $pos_446;
$_457 = FALSE; break;
}
while(0);
if( $_457 === TRUE ) { $_459 = TRUE; break; }
$result = $res_444;
$this->pos = $pos_444;
$_459 = FALSE; break;
}
while(0);
if( $_459 === TRUE ) { $_461 = TRUE; break; }
$result = $res_442;
$this->pos = $pos_442;
$_461 = FALSE; break;
}
while(0);
if( $_461 === TRUE ) { $_463 = TRUE; break; }
$result = $res_440;
$this->pos = $pos_440;
$_463 = FALSE; break;
}
while(0);
if( $_463 === TRUE ) { $_465 = TRUE; break; }
$result = $res_438;
$this->pos = $pos_438;
$_465 = FALSE; break;
}
while(0);
if( $_465 === TRUE ) { $_467 = TRUE; break; }
$result = $res_436;
$this->pos = $pos_436;
$_467 = FALSE; break;
}
while(0);
if( $_467 === TRUE ) { $_469 = TRUE; break; }
$result = $res_434;
$this->pos = $pos_434;
$_469 = FALSE; break;
}
while(0);
if( $_469 === FALSE) { $_471 = FALSE; break; }
$_471 = TRUE; break;
}
while(0);
if( $_471 === FALSE) {
$result = $res_472;
$this->pos = $pos_472;
unset( $res_472 );
unset( $pos_472 );
break;
}
$count += 1;
}
if ($count > 0) {
return $this->finalise( "TopTemplate", $result );
}
else { return FALSE; }
}
/**
* 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 * 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; 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 /*!* 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_]* / Word: / [A-Za-z_] [A-Za-z0-9_]* /
Number: / [0-9]+ / Number: / [0-9]+ /
Value: / [A-Za-z0-9_]+ / Value: / [A-Za-z0-9_]+ /
@ -102,8 +122,7 @@ class SSTemplateParser extends Parser {
* to numbers when needed. * to numbers when needed.
*/ */
function CallArguments_Argument(&$res, $sub) { function CallArguments_Argument(&$res, $sub) {
if (isset($res['php'])) $res['php'] .= ', '; if (!empty($res['php'])) $res['php'] .= ', ';
else $res['php'] = '';
$res['php'] .= ($sub['ArgumentMode'] == 'default') ? $sub['string_php'] : str_replace('$$FINAL', 'XML_val', $sub['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) { function Comparison_Argument(&$res, $sub) {
if ($sub['ArgumentMode'] == 'default') { 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 $res['php'] = str_replace('$$FINAL', 'XML_val', $sub['lookup_php']);
} }
else { else {
if (!isset($res['php'])) $res['php'] = '';
$res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']); $res['php'] .= str_replace('$$FINAL', 'XML_val', $sub['php']);
} }
} }
@ -279,10 +297,6 @@ class SSTemplateParser extends Parser {
PresenceCheck: (Not:'not' <)? Argument PresenceCheck: (Not:'not' <)? Argument
*/ */
function PresenceCheck__construct(&$res) {
$res['php'] = '';
}
function PresenceCheck_Not(&$res, $sub) { function PresenceCheck_Not(&$res, $sub) {
$res['php'] = '!'; $res['php'] = '!';
} }
@ -320,9 +334,6 @@ class SSTemplateParser extends Parser {
IfArgument: :IfArgumentPortion ( < :BooleanOperator < :IfArgumentPortion )* IfArgument: :IfArgumentPortion ( < :BooleanOperator < :IfArgumentPortion )*
*/ */
function IfArgument__construct(&$res){
$res['php'] = '';
}
function IfArgument_IfArgumentPortion(&$res, $sub) { function IfArgument_IfArgumentPortion(&$res, $sub) {
$res['php'] .= $sub['php']; $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 # 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 # argument structure to every other block
IfPart: '<%' < 'if' [ :IfArgument > '%>' :Template? IfPart: '<%' < 'if' [ :IfArgument > '%>' Template:$TemplateMatcher?
ElseIfPart: '<%' < 'else_if' [ :IfArgument > '%>' :Template ElseIfPart: '<%' < 'else_if' [ :IfArgument > '%>' Template:$TemplateMatcher
ElsePart: '<%' < 'else' > '%>' :Template ElsePart: '<%' < 'else' > '%>' Template:$TemplateMatcher
If: IfPart ElseIfPart* ElsePart? '<%' < 'end_if' > '%>' If: IfPart ElseIfPart* ElsePart? '<%' < 'end_if' > '%>'
*/ */
@ -375,6 +386,120 @@ class SSTemplateParser extends Parser {
$res['php'] = "Requirements::".$sub['Method']['text'].'('.$sub['CallArguments']['php'].');'; $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 # 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 # 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 # 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 # Match against closed blocks - blocks with an opening and a closing tag that surround some internal portion of
# template # 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 # 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 # closing tags are detected as an invalid open tag
MismatchedEndBlock: '<%' < 'end_' Word > '%>' MismatchedEndBlock: '<%' < 'end_' :Word > '%>'
*/ */
function MismatchedEndBlock__finalise(&$res) { function MismatchedEndBlock__finalise(&$res) {
$blockname = $res['Word']['text']; $blockname = $res['Word']['text'];
@ -699,6 +824,21 @@ class SSTemplateParser extends Parser {
/*!* /*!*
# 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) # Text matches anything that isn't a template command (not an injection, block of any kind or comment)
Text: / Text: /
@ -711,18 +851,14 @@ class SSTemplateParser extends Parser {
({$[^A-Za-z_]) # {$ if not followed A-Z, a-z or _ ({$[^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( $text = preg_replace(
'/href\s*\=\s*\"\#/', '/href\s*\=\s*\"\#/',
'href="<?= SSViewer::{dlr}options[\'rewriteHashlinks\'] ? Convert::raw2att( {dlr}_SERVER[\'REQUEST_URI\'] ) : "" ?>#', 'href="<?= SSViewer::{dlr}options[\'rewriteHashlinks\'] ? Convert::raw2att( {dlr}_SERVER[\'REQUEST_URI\'] ) : "" ?>#',
@ -738,32 +874,6 @@ class SSTemplateParser extends Parser {
'SSVIEWER;' . 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 * 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 '); $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 * @expectedException Exception
*/ */