public function scanDelims($start, $canSplitWord)
    {
        $pos = $start;
        $left_flanking = true;
        $right_flanking = true;
        $max = $this->posMax;
        $marker = $this->md->utils->currentCharUTF8($this->src, $start, $outLen);


        // treat beginning of the line as a whitespace
//        $lastChar = $start > 0 ? $this->src[$start-1] : ' ';
        $lastPos = $start;
        if( $start > 0 ){
            $lastChar = $this->md->utils->lastCharUTF8($this->src, $start, $lastPos);
            if( $lastChar === '' ){
                throw new \Exception('scanDelims(), last char unexpected error...');
            }
        }
        else
            $lastChar = ' ';

        //while ($pos < $max && $this->src[$pos] === $marker) { $pos++; }
        while ($pos < $max && ($nextChar=$this->md->utils->currentCharUTF8($this->src, $pos, $outLen)) === $marker) {
            $pos+=$outLen;
        }
        ;
        $count = $pos - $start;

        // treat end of the line as a whitespace
        $nextChar = $pos < $max ? $nextChar : ' ';

        $isLastPunctChar = $this->md->utils->isMdAsciiPunct($lastChar) || $this->md->utils->isPunctChar($lastChar);
        $isNextPunctChar = $this->md->utils->isMdAsciiPunct($nextChar) || $this->md->utils->isPunctChar($nextChar);

        $isLastWhiteSpace = $this->md->utils->isWhiteSpace($lastChar);
        $isNextWhiteSpace = $this->md->utils->isWhiteSpace($nextChar);

        if ($isNextWhiteSpace) {
            $left_flanking = false;
        } else if ($isNextPunctChar) {
            if (!($isLastWhiteSpace || $isLastPunctChar)) {
                $left_flanking = false;
            }
        }

        if ($isLastWhiteSpace) {
            $right_flanking = false;
        } else if ($isLastPunctChar) {
            if (!($isNextWhiteSpace || $isNextPunctChar)) {
                $right_flanking = false;
            }
        }

        if (!$canSplitWord) {
            $can_open  = $left_flanking  && (!$right_flanking || $isLastPunctChar);
            $can_close = $right_flanking && (!$left_flanking  || $isNextPunctChar);
        } else {
            $can_open  = $left_flanking;
            $can_close = $right_flanking;
        }

        $obj = new \stdClass();
        $obj->can_open = $can_open;
        $obj->can_close = $can_close;
        $obj->length = $count;

        return $obj;
    }