mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX: Stop empty comments breaking the template parser (fixes #8742)
This commit is contained in:
parent
e339549e0d
commit
bfc3b4b468
@ -1156,7 +1156,9 @@ class SSTemplateParser extends Parser implements TemplateParser
|
|||||||
|
|
||||||
# This is used to remove template comments
|
# This is used to remove template comments
|
||||||
|
|
||||||
Comment: "<%--" (!"--%>" /(?s)./)+ "--%>"
|
CommentWithContent: '<%--' ( !"--%>" /(?s)./ )+ '--%>'
|
||||||
|
EmptyComment: '<%----%>'
|
||||||
|
Comment: :EmptyComment | :CommentWithContent
|
||||||
*/
|
*/
|
||||||
function Comment__construct(&$res)
|
function Comment__construct(&$res)
|
||||||
{
|
{
|
||||||
|
@ -4269,10 +4269,10 @@ class SSTemplateParser extends Parser implements TemplateParser
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Comment: "<%--" (!"--%>" /(?s)./)+ "--%>" */
|
/* CommentWithContent: '<%--' ( !"--%>" /(?s)./ )+ '--%>' */
|
||||||
protected $match_Comment_typestack = array('Comment');
|
protected $match_CommentWithContent_typestack = array('CommentWithContent');
|
||||||
function match_Comment ($stack = array()) {
|
function match_CommentWithContent ($stack = array()) {
|
||||||
$matchrule = "Comment"; $result = $this->construct($matchrule, $matchrule, null);
|
$matchrule = "CommentWithContent"; $result = $this->construct($matchrule, $matchrule, null);
|
||||||
$_693 = NULL;
|
$_693 = NULL;
|
||||||
do {
|
do {
|
||||||
if (( $subres = $this->literal( '<%--' ) ) !== FALSE) { $result["text"] .= $subres; }
|
if (( $subres = $this->literal( '<%--' ) ) !== FALSE) { $result["text"] .= $subres; }
|
||||||
@ -4321,6 +4321,50 @@ class SSTemplateParser extends Parser implements TemplateParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* EmptyComment: '<%----%>' */
|
||||||
|
protected $match_EmptyComment_typestack = array('EmptyComment');
|
||||||
|
function match_EmptyComment ($stack = array()) {
|
||||||
|
$matchrule = "EmptyComment"; $result = $this->construct($matchrule, $matchrule, null);
|
||||||
|
if (( $subres = $this->literal( '<%----%>' ) ) !== FALSE) {
|
||||||
|
$result["text"] .= $subres;
|
||||||
|
return $this->finalise($result);
|
||||||
|
}
|
||||||
|
else { return FALSE; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Comment: :EmptyComment | :CommentWithContent */
|
||||||
|
protected $match_Comment_typestack = array('Comment');
|
||||||
|
function match_Comment ($stack = array()) {
|
||||||
|
$matchrule = "Comment"; $result = $this->construct($matchrule, $matchrule, null);
|
||||||
|
$_699 = NULL;
|
||||||
|
do {
|
||||||
|
$res_696 = $result;
|
||||||
|
$pos_696 = $this->pos;
|
||||||
|
$matcher = 'match_'.'EmptyComment'; $key = $matcher; $pos = $this->pos;
|
||||||
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
||||||
|
if ($subres !== FALSE) {
|
||||||
|
$this->store( $result, $subres, "EmptyComment" );
|
||||||
|
$_699 = TRUE; break;
|
||||||
|
}
|
||||||
|
$result = $res_696;
|
||||||
|
$this->pos = $pos_696;
|
||||||
|
$matcher = 'match_'.'CommentWithContent'; $key = $matcher; $pos = $this->pos;
|
||||||
|
$subres = ( $this->packhas( $key, $pos ) ? $this->packread( $key, $pos ) : $this->packwrite( $key, $pos, $this->$matcher(array_merge($stack, array($result))) ) );
|
||||||
|
if ($subres !== FALSE) {
|
||||||
|
$this->store( $result, $subres, "CommentWithContent" );
|
||||||
|
$_699 = TRUE; break;
|
||||||
|
}
|
||||||
|
$result = $res_696;
|
||||||
|
$this->pos = $pos_696;
|
||||||
|
$_699 = FALSE; break;
|
||||||
|
}
|
||||||
|
while(0);
|
||||||
|
if( $_699 === TRUE ) { return $this->finalise($result); }
|
||||||
|
if( $_699 === FALSE) { return FALSE; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Comment__construct(&$res)
|
function Comment__construct(&$res)
|
||||||
{
|
{
|
||||||
@ -4334,260 +4378,260 @@ class SSTemplateParser extends Parser implements TemplateParser
|
|||||||
$matchrule = "TopTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'Template'));
|
$matchrule = "TopTemplate"; $result = $this->construct($matchrule, $matchrule, array('TemplateMatcher' => 'Template'));
|
||||||
$count = 0;
|
$count = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
$res_749 = $result;
|
$res_755 = $result;
|
||||||
$pos_749 = $this->pos;
|
$pos_755 = $this->pos;
|
||||||
$_748 = NULL;
|
$_754 = NULL;
|
||||||
do {
|
do {
|
||||||
$_746 = NULL;
|
$_752 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_695 = $result;
|
$res_701 = $result;
|
||||||
$pos_695 = $this->pos;
|
$pos_701 = $this->pos;
|
||||||
$matcher = 'match_'.'Comment'; $key = $matcher; $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->$matcher(array_merge($stack, 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 );
|
||||||
$_746 = TRUE; break;
|
$_752 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_695;
|
$result = $res_701;
|
||||||
$this->pos = $pos_695;
|
$this->pos = $pos_701;
|
||||||
$_744 = NULL;
|
$_750 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_697 = $result;
|
$res_703 = $result;
|
||||||
$pos_697 = $this->pos;
|
$pos_703 = $this->pos;
|
||||||
$matcher = 'match_'.'Translate'; $key = $matcher; $pos = $this->pos;
|
$matcher = 'match_'.'Translate'; $key = $matcher; $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->$matcher(array_merge($stack, array($result))) ) );
|
||||||
if ($subres !== FALSE) {
|
if ($subres !== FALSE) {
|
||||||
$this->store( $result, $subres );
|
$this->store( $result, $subres );
|
||||||
$_744 = TRUE; break;
|
$_750 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_697;
|
$result = $res_703;
|
||||||
$this->pos = $pos_697;
|
$this->pos = $pos_703;
|
||||||
$_742 = NULL;
|
$_748 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_699 = $result;
|
$res_705 = $result;
|
||||||
$pos_699 = $this->pos;
|
$pos_705 = $this->pos;
|
||||||
$matcher = 'match_'.'If'; $key = $matcher; $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->$matcher(array_merge($stack, 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 );
|
||||||
$_742 = TRUE; break;
|
$_748 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_699;
|
$result = $res_705;
|
||||||
$this->pos = $pos_699;
|
$this->pos = $pos_705;
|
||||||
$_740 = NULL;
|
$_746 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_701 = $result;
|
$res_707 = $result;
|
||||||
$pos_701 = $this->pos;
|
$pos_707 = $this->pos;
|
||||||
$matcher = 'match_'.'Require'; $key = $matcher; $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->$matcher(array_merge($stack, 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 );
|
||||||
$_740 = TRUE; break;
|
$_746 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_701;
|
$result = $res_707;
|
||||||
$this->pos = $pos_701;
|
$this->pos = $pos_707;
|
||||||
$_738 = NULL;
|
$_744 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_703 = $result;
|
$res_709 = $result;
|
||||||
$pos_703 = $this->pos;
|
$pos_709 = $this->pos;
|
||||||
$matcher = 'match_'.'CacheBlock'; $key = $matcher; $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->$matcher(array_merge($stack, 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 );
|
||||||
$_738 = TRUE; break;
|
$_744 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_703;
|
$result = $res_709;
|
||||||
$this->pos = $pos_703;
|
$this->pos = $pos_709;
|
||||||
$_736 = NULL;
|
$_742 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_705 = $result;
|
$res_711 = $result;
|
||||||
$pos_705 = $this->pos;
|
$pos_711 = $this->pos;
|
||||||
$matcher = 'match_'.'UncachedBlock'; $key = $matcher; $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->$matcher(array_merge($stack, 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 );
|
||||||
$_736 = TRUE; break;
|
$_742 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_705;
|
$result = $res_711;
|
||||||
$this->pos = $pos_705;
|
$this->pos = $pos_711;
|
||||||
$_734 = NULL;
|
$_740 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_707 = $result;
|
$res_713 = $result;
|
||||||
$pos_707 = $this->pos;
|
$pos_713 = $this->pos;
|
||||||
$matcher = 'match_'.'OldI18NTag'; $key = $matcher; $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->$matcher(array_merge($stack, 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 );
|
||||||
$_734 = TRUE; break;
|
$_740 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_707;
|
$result = $res_713;
|
||||||
$this->pos = $pos_707;
|
$this->pos = $pos_713;
|
||||||
$_732 = NULL;
|
$_738 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_709 = $result;
|
$res_715 = $result;
|
||||||
$pos_709 = $this->pos;
|
$pos_715 = $this->pos;
|
||||||
$matcher = 'match_'.'Include'; $key = $matcher; $pos = $this->pos;
|
$matcher = 'match_'.'Include'; $key = $matcher; $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->$matcher(array_merge($stack, array($result))) ) );
|
||||||
if ($subres !== FALSE) {
|
if ($subres !== FALSE) {
|
||||||
$this->store( $result, $subres );
|
$this->store( $result, $subres );
|
||||||
$_732 = TRUE; break;
|
$_738 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_709;
|
$result = $res_715;
|
||||||
$this->pos = $pos_709;
|
$this->pos = $pos_715;
|
||||||
$_730 = NULL;
|
$_736 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_711 = $result;
|
$res_717 = $result;
|
||||||
$pos_711 = $this->pos;
|
$pos_717 = $this->pos;
|
||||||
$matcher = 'match_'.'ClosedBlock'; $key = $matcher; $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->$matcher(array_merge($stack, 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 );
|
||||||
$_730 = TRUE; break;
|
$_736 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_711;
|
$result = $res_717;
|
||||||
$this->pos = $pos_711;
|
$this->pos = $pos_717;
|
||||||
$_728 = NULL;
|
$_734 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_713 = $result;
|
$res_719 = $result;
|
||||||
$pos_713 = $this->pos;
|
$pos_719 = $this->pos;
|
||||||
$matcher = 'match_'.'OpenBlock'; $key = $matcher; $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->$matcher(array_merge($stack, 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 );
|
||||||
$_728 = TRUE; break;
|
$_734 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_713;
|
$result = $res_719;
|
||||||
$this->pos = $pos_713;
|
$this->pos = $pos_719;
|
||||||
$_726 = NULL;
|
$_732 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_715 = $result;
|
$res_721 = $result;
|
||||||
$pos_715 = $this->pos;
|
$pos_721 = $this->pos;
|
||||||
$matcher = 'match_'.'MalformedBlock'; $key = $matcher; $pos = $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))) ) );
|
$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 );
|
||||||
$_726 = TRUE; break;
|
$_732 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_715;
|
$result = $res_721;
|
||||||
$this->pos = $pos_715;
|
$this->pos = $pos_721;
|
||||||
$_724 = NULL;
|
$_730 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_717 = $result;
|
$res_723 = $result;
|
||||||
$pos_717 = $this->pos;
|
$pos_723 = $this->pos;
|
||||||
$matcher = 'match_'.'MismatchedEndBlock'; $key = $matcher; $pos = $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))) ) );
|
$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 );
|
||||||
$_724 = TRUE; break;
|
$_730 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_717;
|
$result = $res_723;
|
||||||
$this->pos = $pos_717;
|
$this->pos = $pos_723;
|
||||||
$_722 = NULL;
|
$_728 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_719 = $result;
|
$res_725 = $result;
|
||||||
$pos_719 = $this->pos;
|
$pos_725 = $this->pos;
|
||||||
$matcher = 'match_'.'Injection'; $key = $matcher; $pos = $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))) ) );
|
$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 );
|
||||||
$_722 = TRUE; break;
|
$_728 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_719;
|
$result = $res_725;
|
||||||
$this->pos = $pos_719;
|
$this->pos = $pos_725;
|
||||||
$matcher = 'match_'.'Text'; $key = $matcher; $pos = $this->pos;
|
$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))) ) );
|
$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 );
|
||||||
$_722 = TRUE; break;
|
$_728 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_719;
|
$result = $res_725;
|
||||||
$this->pos = $pos_719;
|
$this->pos = $pos_725;
|
||||||
$_722 = FALSE; break;
|
$_728 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_722 === TRUE ) {
|
if( $_728 === TRUE ) {
|
||||||
$_724 = TRUE; break;
|
$_730 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_717;
|
$result = $res_723;
|
||||||
$this->pos = $pos_717;
|
$this->pos = $pos_723;
|
||||||
$_724 = FALSE; break;
|
$_730 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_724 === TRUE ) { $_726 = TRUE; break; }
|
if( $_730 === TRUE ) { $_732 = TRUE; break; }
|
||||||
$result = $res_715;
|
$result = $res_721;
|
||||||
$this->pos = $pos_715;
|
$this->pos = $pos_721;
|
||||||
$_726 = FALSE; break;
|
$_732 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_726 === TRUE ) { $_728 = TRUE; break; }
|
if( $_732 === TRUE ) { $_734 = TRUE; break; }
|
||||||
$result = $res_713;
|
$result = $res_719;
|
||||||
$this->pos = $pos_713;
|
$this->pos = $pos_719;
|
||||||
$_728 = FALSE; break;
|
$_734 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_728 === TRUE ) { $_730 = TRUE; break; }
|
if( $_734 === TRUE ) { $_736 = TRUE; break; }
|
||||||
$result = $res_711;
|
$result = $res_717;
|
||||||
$this->pos = $pos_711;
|
$this->pos = $pos_717;
|
||||||
$_730 = FALSE; break;
|
$_736 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_730 === TRUE ) { $_732 = TRUE; break; }
|
if( $_736 === TRUE ) { $_738 = TRUE; break; }
|
||||||
$result = $res_709;
|
$result = $res_715;
|
||||||
$this->pos = $pos_709;
|
$this->pos = $pos_715;
|
||||||
$_732 = FALSE; break;
|
$_738 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_732 === TRUE ) { $_734 = TRUE; break; }
|
if( $_738 === TRUE ) { $_740 = TRUE; break; }
|
||||||
$result = $res_707;
|
$result = $res_713;
|
||||||
$this->pos = $pos_707;
|
$this->pos = $pos_713;
|
||||||
$_734 = FALSE; break;
|
$_740 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_734 === TRUE ) { $_736 = TRUE; break; }
|
if( $_740 === TRUE ) { $_742 = TRUE; break; }
|
||||||
$result = $res_705;
|
$result = $res_711;
|
||||||
$this->pos = $pos_705;
|
$this->pos = $pos_711;
|
||||||
$_736 = FALSE; break;
|
$_742 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_736 === TRUE ) { $_738 = TRUE; break; }
|
if( $_742 === TRUE ) { $_744 = TRUE; break; }
|
||||||
$result = $res_703;
|
$result = $res_709;
|
||||||
$this->pos = $pos_703;
|
$this->pos = $pos_709;
|
||||||
$_738 = FALSE; break;
|
$_744 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_738 === TRUE ) { $_740 = TRUE; break; }
|
if( $_744 === TRUE ) { $_746 = TRUE; break; }
|
||||||
$result = $res_701;
|
$result = $res_707;
|
||||||
$this->pos = $pos_701;
|
$this->pos = $pos_707;
|
||||||
$_740 = FALSE; break;
|
$_746 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_740 === TRUE ) { $_742 = TRUE; break; }
|
if( $_746 === TRUE ) { $_748 = TRUE; break; }
|
||||||
$result = $res_699;
|
$result = $res_705;
|
||||||
$this->pos = $pos_699;
|
$this->pos = $pos_705;
|
||||||
$_742 = FALSE; break;
|
$_748 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_742 === TRUE ) { $_744 = TRUE; break; }
|
if( $_748 === TRUE ) { $_750 = TRUE; break; }
|
||||||
$result = $res_697;
|
$result = $res_703;
|
||||||
$this->pos = $pos_697;
|
$this->pos = $pos_703;
|
||||||
$_744 = FALSE; break;
|
$_750 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_744 === TRUE ) { $_746 = TRUE; break; }
|
if( $_750 === TRUE ) { $_752 = TRUE; break; }
|
||||||
$result = $res_695;
|
$result = $res_701;
|
||||||
$this->pos = $pos_695;
|
$this->pos = $pos_701;
|
||||||
$_746 = FALSE; break;
|
$_752 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_746 === FALSE) { $_748 = FALSE; break; }
|
if( $_752 === FALSE) { $_754 = FALSE; break; }
|
||||||
$_748 = TRUE; break;
|
$_754 = TRUE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_748 === FALSE) {
|
if( $_754 === FALSE) {
|
||||||
$result = $res_749;
|
$result = $res_755;
|
||||||
$this->pos = $pos_749;
|
$this->pos = $pos_755;
|
||||||
unset( $res_749 );
|
unset( $res_755 );
|
||||||
unset( $pos_749 );
|
unset( $pos_755 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$count += 1;
|
$count += 1;
|
||||||
@ -4620,195 +4664,195 @@ class SSTemplateParser extends Parser implements TemplateParser
|
|||||||
$matchrule = "Text"; $result = $this->construct($matchrule, $matchrule, null);
|
$matchrule = "Text"; $result = $this->construct($matchrule, $matchrule, null);
|
||||||
$count = 0;
|
$count = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
$res_788 = $result;
|
$res_794 = $result;
|
||||||
$pos_788 = $this->pos;
|
$pos_794 = $this->pos;
|
||||||
$_787 = NULL;
|
$_793 = NULL;
|
||||||
do {
|
do {
|
||||||
$_785 = NULL;
|
$_791 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_750 = $result;
|
$res_756 = $result;
|
||||||
$pos_750 = $this->pos;
|
$pos_756 = $this->pos;
|
||||||
if (( $subres = $this->rx( '/ [^<${\\\\]+ /' ) ) !== FALSE) {
|
if (( $subres = $this->rx( '/ [^<${\\\\]+ /' ) ) !== FALSE) {
|
||||||
$result["text"] .= $subres;
|
$result["text"] .= $subres;
|
||||||
$_785 = TRUE; break;
|
$_791 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_750;
|
$result = $res_756;
|
||||||
$this->pos = $pos_750;
|
$this->pos = $pos_756;
|
||||||
$_783 = NULL;
|
$_789 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_752 = $result;
|
$res_758 = $result;
|
||||||
$pos_752 = $this->pos;
|
$pos_758 = $this->pos;
|
||||||
if (( $subres = $this->rx( '/ (\\\\.) /' ) ) !== FALSE) {
|
if (( $subres = $this->rx( '/ (\\\\.) /' ) ) !== FALSE) {
|
||||||
$result["text"] .= $subres;
|
$result["text"] .= $subres;
|
||||||
$_783 = TRUE; break;
|
$_789 = TRUE; break;
|
||||||
}
|
}
|
||||||
$result = $res_752;
|
$result = $res_758;
|
||||||
$this->pos = $pos_752;
|
$this->pos = $pos_758;
|
||||||
$_781 = NULL;
|
$_787 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_754 = $result;
|
$res_760 = $result;
|
||||||
$pos_754 = $this->pos;
|
$pos_760 = $this->pos;
|
||||||
$_757 = NULL;
|
$_763 = 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 { $_757 = FALSE; break; }
|
else { $_763 = FALSE; break; }
|
||||||
$res_756 = $result;
|
$res_762 = $result;
|
||||||
$pos_756 = $this->pos;
|
$pos_762 = $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_756;
|
$result = $res_762;
|
||||||
$this->pos = $pos_756;
|
$this->pos = $pos_762;
|
||||||
$_757 = FALSE; break;
|
$_763 = FALSE; break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$result = $res_756;
|
$result = $res_762;
|
||||||
$this->pos = $pos_756;
|
$this->pos = $pos_762;
|
||||||
}
|
}
|
||||||
$_757 = TRUE; break;
|
$_763 = TRUE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_757 === TRUE ) { $_781 = TRUE; break; }
|
if( $_763 === TRUE ) { $_787 = TRUE; break; }
|
||||||
$result = $res_754;
|
$result = $res_760;
|
||||||
$this->pos = $pos_754;
|
$this->pos = $pos_760;
|
||||||
$_779 = NULL;
|
$_785 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_759 = $result;
|
$res_765 = $result;
|
||||||
$pos_759 = $this->pos;
|
$pos_765 = $this->pos;
|
||||||
$_764 = NULL;
|
$_770 = 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 { $_764 = FALSE; break; }
|
else { $_770 = FALSE; break; }
|
||||||
$res_763 = $result;
|
$res_769 = $result;
|
||||||
$pos_763 = $this->pos;
|
$pos_769 = $this->pos;
|
||||||
$_762 = NULL;
|
$_768 = NULL;
|
||||||
do {
|
do {
|
||||||
if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) {
|
if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) {
|
||||||
$result["text"] .= $subres;
|
$result["text"] .= $subres;
|
||||||
}
|
}
|
||||||
else { $_762 = FALSE; break; }
|
else { $_768 = FALSE; break; }
|
||||||
$_762 = TRUE; break;
|
$_768 = TRUE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_762 === TRUE ) {
|
if( $_768 === TRUE ) {
|
||||||
$result = $res_763;
|
$result = $res_769;
|
||||||
$this->pos = $pos_763;
|
$this->pos = $pos_769;
|
||||||
$_764 = FALSE; break;
|
$_770 = FALSE; break;
|
||||||
}
|
}
|
||||||
if( $_762 === FALSE) {
|
if( $_768 === FALSE) {
|
||||||
$result = $res_763;
|
$result = $res_769;
|
||||||
$this->pos = $pos_763;
|
$this->pos = $pos_769;
|
||||||
}
|
}
|
||||||
$_764 = TRUE; break;
|
$_770 = TRUE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_764 === TRUE ) { $_779 = TRUE; break; }
|
if( $_770 === TRUE ) { $_785 = TRUE; break; }
|
||||||
$result = $res_759;
|
$result = $res_765;
|
||||||
$this->pos = $pos_759;
|
$this->pos = $pos_765;
|
||||||
$_777 = NULL;
|
$_783 = NULL;
|
||||||
do {
|
do {
|
||||||
$res_766 = $result;
|
$res_772 = $result;
|
||||||
$pos_766 = $this->pos;
|
$pos_772 = $this->pos;
|
||||||
$_769 = NULL;
|
$_775 = 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 { $_769 = FALSE; break; }
|
|
||||||
$res_768 = $result;
|
|
||||||
$pos_768 = $this->pos;
|
|
||||||
if (substr($this->string,$this->pos,1) == '$') {
|
|
||||||
$this->pos += 1;
|
|
||||||
$result["text"] .= '$';
|
|
||||||
$result = $res_768;
|
|
||||||
$this->pos = $pos_768;
|
|
||||||
$_769 = FALSE; break;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$result = $res_768;
|
|
||||||
$this->pos = $pos_768;
|
|
||||||
}
|
|
||||||
$_769 = TRUE; break;
|
|
||||||
}
|
|
||||||
while(0);
|
|
||||||
if( $_769 === TRUE ) { $_777 = TRUE; break; }
|
|
||||||
$result = $res_766;
|
|
||||||
$this->pos = $pos_766;
|
|
||||||
$_775 = NULL;
|
|
||||||
do {
|
|
||||||
if (( $subres = $this->literal( '{$' ) ) !== FALSE) {
|
|
||||||
$result["text"] .= $subres;
|
|
||||||
}
|
|
||||||
else { $_775 = FALSE; break; }
|
else { $_775 = FALSE; break; }
|
||||||
$res_774 = $result;
|
$res_774 = $result;
|
||||||
$pos_774 = $this->pos;
|
$pos_774 = $this->pos;
|
||||||
$_773 = NULL;
|
if (substr($this->string,$this->pos,1) == '$') {
|
||||||
do {
|
$this->pos += 1;
|
||||||
if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) {
|
$result["text"] .= '$';
|
||||||
$result["text"] .= $subres;
|
|
||||||
}
|
|
||||||
else { $_773 = FALSE; break; }
|
|
||||||
$_773 = TRUE; break;
|
|
||||||
}
|
|
||||||
while(0);
|
|
||||||
if( $_773 === TRUE ) {
|
|
||||||
$result = $res_774;
|
$result = $res_774;
|
||||||
$this->pos = $pos_774;
|
$this->pos = $pos_774;
|
||||||
$_775 = FALSE; break;
|
$_775 = FALSE; break;
|
||||||
}
|
}
|
||||||
if( $_773 === FALSE) {
|
else {
|
||||||
$result = $res_774;
|
$result = $res_774;
|
||||||
$this->pos = $pos_774;
|
$this->pos = $pos_774;
|
||||||
}
|
}
|
||||||
$_775 = TRUE; break;
|
$_775 = TRUE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_775 === TRUE ) { $_777 = TRUE; break; }
|
if( $_775 === TRUE ) { $_783 = TRUE; break; }
|
||||||
$result = $res_766;
|
$result = $res_772;
|
||||||
$this->pos = $pos_766;
|
$this->pos = $pos_772;
|
||||||
$_777 = FALSE; break;
|
$_781 = NULL;
|
||||||
|
do {
|
||||||
|
if (( $subres = $this->literal( '{$' ) ) !== FALSE) {
|
||||||
|
$result["text"] .= $subres;
|
||||||
|
}
|
||||||
|
else { $_781 = FALSE; break; }
|
||||||
|
$res_780 = $result;
|
||||||
|
$pos_780 = $this->pos;
|
||||||
|
$_779 = NULL;
|
||||||
|
do {
|
||||||
|
if (( $subres = $this->rx( '/[A-Za-z_]/' ) ) !== FALSE) {
|
||||||
|
$result["text"] .= $subres;
|
||||||
|
}
|
||||||
|
else { $_779 = FALSE; break; }
|
||||||
|
$_779 = TRUE; break;
|
||||||
|
}
|
||||||
|
while(0);
|
||||||
|
if( $_779 === TRUE ) {
|
||||||
|
$result = $res_780;
|
||||||
|
$this->pos = $pos_780;
|
||||||
|
$_781 = FALSE; break;
|
||||||
|
}
|
||||||
|
if( $_779 === FALSE) {
|
||||||
|
$result = $res_780;
|
||||||
|
$this->pos = $pos_780;
|
||||||
|
}
|
||||||
|
$_781 = TRUE; break;
|
||||||
|
}
|
||||||
|
while(0);
|
||||||
|
if( $_781 === TRUE ) { $_783 = TRUE; break; }
|
||||||
|
$result = $res_772;
|
||||||
|
$this->pos = $pos_772;
|
||||||
|
$_783 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_777 === TRUE ) { $_779 = TRUE; break; }
|
if( $_783 === TRUE ) { $_785 = TRUE; break; }
|
||||||
$result = $res_759;
|
$result = $res_765;
|
||||||
$this->pos = $pos_759;
|
$this->pos = $pos_765;
|
||||||
$_779 = FALSE; break;
|
$_785 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_779 === TRUE ) { $_781 = TRUE; break; }
|
if( $_785 === TRUE ) { $_787 = TRUE; break; }
|
||||||
$result = $res_754;
|
$result = $res_760;
|
||||||
$this->pos = $pos_754;
|
$this->pos = $pos_760;
|
||||||
$_781 = FALSE; break;
|
$_787 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_781 === TRUE ) { $_783 = TRUE; break; }
|
if( $_787 === TRUE ) { $_789 = TRUE; break; }
|
||||||
$result = $res_752;
|
$result = $res_758;
|
||||||
$this->pos = $pos_752;
|
$this->pos = $pos_758;
|
||||||
$_783 = FALSE; break;
|
$_789 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_783 === TRUE ) { $_785 = TRUE; break; }
|
if( $_789 === TRUE ) { $_791 = TRUE; break; }
|
||||||
$result = $res_750;
|
$result = $res_756;
|
||||||
$this->pos = $pos_750;
|
$this->pos = $pos_756;
|
||||||
$_785 = FALSE; break;
|
$_791 = FALSE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_785 === FALSE) { $_787 = FALSE; break; }
|
if( $_791 === FALSE) { $_793 = FALSE; break; }
|
||||||
$_787 = TRUE; break;
|
$_793 = TRUE; break;
|
||||||
}
|
}
|
||||||
while(0);
|
while(0);
|
||||||
if( $_787 === FALSE) {
|
if( $_793 === FALSE) {
|
||||||
$result = $res_788;
|
$result = $res_794;
|
||||||
$this->pos = $pos_788;
|
$this->pos = $pos_794;
|
||||||
unset( $res_788 );
|
unset( $res_794 );
|
||||||
unset( $pos_788 );
|
unset( $pos_794 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$count += 1;
|
$count += 1;
|
||||||
|
@ -321,16 +321,33 @@ Some more content
|
|||||||
Mixing content and <%-- multi
|
Mixing content and <%-- multi
|
||||||
line comment --%> Final final
|
line comment --%> Final final
|
||||||
content
|
content
|
||||||
|
<%--commentwithoutwhitespace--%>last content
|
||||||
SS;
|
SS;
|
||||||
$output = $this->render($input);
|
$actual = $this->render($input);
|
||||||
$shouldbe = <<<SS
|
$expected = <<<SS
|
||||||
This is my templateThis is some contentFinal content
|
This is my templateThis is some contentFinal content
|
||||||
|
|
||||||
Some more content
|
Some more content
|
||||||
Mixing content and Final final
|
Mixing content and Final final
|
||||||
content
|
content
|
||||||
|
last content
|
||||||
SS;
|
SS;
|
||||||
$this->assertEquals($shouldbe, $output);
|
$this->assertEquals($expected, $actual);
|
||||||
|
|
||||||
|
$input = <<<SS
|
||||||
|
<%--
|
||||||
|
|
||||||
|
--%>empty comment1
|
||||||
|
<%-- --%>empty comment2
|
||||||
|
<%----%>empty comment3
|
||||||
|
SS;
|
||||||
|
$actual = $this->render($input);
|
||||||
|
$expected = <<<SS
|
||||||
|
empty comment1
|
||||||
|
empty comment2
|
||||||
|
empty comment3
|
||||||
|
SS;
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBasicText()
|
public function testBasicText()
|
||||||
|
Loading…
Reference in New Issue
Block a user