@@ -25,6 +25,8 @@ public static function verify(Context $context, string $template): void
2525 Token::setDelimiter ($ context );
2626
2727 while (preg_match ($ context ->tokenSearch , $ template , $ matches )) {
28+ var_dump ($ template ); echo "\n" ;
29+ var_dump ($ context ->level );
2830 // Skip a token when it is slash escaped
2931 if ($ matches [Token::POS_LSPACE ] === '' && preg_match ('/^(.*?)( \\\\+)$/s ' , $ matches [Token::POS_LOTHER ], $ escmatch )) {
3032 if (strlen ($ escmatch [2 ]) % 4 ) {
@@ -434,8 +436,12 @@ protected static function blockEnd(Context $context, array $vars, ?string $match
434436 $ elseChain = array_shift ($ context ->elseLvl );
435437 if (isset ($ elseChain [0 ])) {
436438 // we need to repeat a level due to else chains: {{else if}}
439+ var_dump ($ elseChain );
437440 $ context ->level ++;
441+ var_dump ($ context ->currentToken );
438442 $ context ->currentToken [Token::POS_RSPACE ] = $ context ->currentToken [Token::POS_BACKFILL ] = '{{/ ' . implode ('}}{{/ ' , $ elseChain ) . '}} ' . Token::toString ($ context ->currentToken ) . $ context ->currentToken [Token::POS_RSPACE ];
443+ var_dump ($ context ->currentToken );
444+ exit ;
439445 return Token::POS_BACKFILL ;
440446 }
441447 // no break
@@ -444,6 +450,7 @@ protected static function blockEnd(Context $context, array $vars, ?string $match
444450 [$ levels , $ spvar , $ var ] = Expression::analyze ($ vars [0 ]);
445451 $ v = Expression::toString ($ levels , $ spvar , $ var );
446452 if ($ pop2 !== $ v ) {
453+ var_dump ($ v , $ pop2 );
447454 $ context ->error [] = 'Unexpect token ' . Token::toString ($ context ->currentToken ) . " ! Previous token {{ {$ pop }$ pop2}} is not closed " ;
448455 return false ;
449456 }
0 commit comments