public static function setDelimiter(&$context, $left = null, $right = null) {
        if ($left === null) {
            $left = $context['delimiters'][0];
        }
        if ($right === null) {
            $right = $context['delimiters'][1];
        }
        if (preg_match('/=/', "$left$right")) {
            $context['error'][] = "Can not set delimiter contains '=' , you try to set delimiter as '$left' and '$right'.";
            return;
        }

        $context['tokens']['startchar'] = substr($left, 0, 1);
        $context['tokens']['left'] = $left;
        $context['tokens']['right'] = $right;
        $rawcount = $context['rawblock'] ? '{2}' : ($context['flags']['rawblock'] ? '{0,2}' : '?');
        $left = preg_quote($left);
        $right = preg_quote($right);

        $context['tokens']['search'] = "/^(.*?)(\\s*)($left)(~?)(\\{{$rawcount})\\s*([\\^#\\/!&>\\*]{0,2})(.*?)\\s*(\\}{$rawcount})(~?)($right)(\\s*)(.*)\$/s";
    }
public static function setDelimiter(&$context, $left = null, $right = null) {
        if ($left === null) {
            $left = $context['delimiters'][0];
        }
        if ($right === null) {
            $right = $context['delimiters'][1];
        }
        if (preg_match('/=/', "$left$right")) {
            $context['error'][] = "Can not set delimiter contains '=' , you try to set delimiter as '$left' and '$right'.";
            return;
        }

        $context['tokens']['startchar'] = substr($left, 0, 1);
        $context['tokens']['left'] = $left;
        $context['tokens']['right'] = $right;
        $rawcount = $context['rawblock'] ? '{2}' : ($context['flags']['rawblock'] ? '{0,2}' : '?');
        $left = preg_quote($left);
        $right = preg_quote($right);

        $context['tokens']['search'] = "/^(.*?)(\\s*)($left)(~?)(\\{{$rawcount})\\s*([\\^#\\/!&>\\*]{0,2})(.*?)\\s*(\\}{$rawcount})(~?)($right)(\\s*)(.*)\$/s";
    }
public static function setDelimiter ( & $ context , $ left = null , $ right = null ) { if ( $ left === null ) { $ left = $ context [ 'delimiters' ] [ 0 ] ; } if ( $ right === null ) { $ right = $ context [ 'delimiters' ] [ 1 ] ; } if ( preg_match ( '/=/' , "$left$right" ) ) { $ context [ 'error' ] [ ] = "Can not set delimiter contains '=' , you try to set delimiter as '$left' and '$right'." ; return ; } $ context [ 'tokens' ] [ 'startchar' ] = substr ( $ left , 0 , 1 ) ; $ context [ 'tokens' ] [ 'left' ] = $ left ; $ context [ 'tokens' ] [ 'right' ] = $ right ; $ rawcount = $ context [ 'rawblock' ] ? '{2}' : ( $ context [ 'flags' ] [ 'rawblock' ] ? '{0,2}' : '?' ) ; $ left = preg_quote ( $ left ) ; $ right = preg_quote ( $ right ) ; $ context [ 'tokens' ] [ 'search' ] = "/^(.*?)(\\s*)($left)(~?)(\\{{$rawcount})\\s*([\\^#\\/!&>\\*]{0,2})(.*?)\\s*(\\}{$rawcount})(~?)($right)(\\s*)(.*)\$/s" ; }
Setup delimiter by default or provided string

@param array<string,array|string|integer> $context Current context
@param string|null $left left string of a token
@param string|null $right right string of a token
Setup delimiter by default or provided string