Esempio n. 1
0
 private static function getBraketsBlock($line, $len, $pos, $brace)
 {
     $stack = new SplStack();
     $stack->push($brace);
     for ($i = $pos + 1; $i < $len && !$stack->isEmpty(); $i++) {
         $c = $line[$i];
         if ($c == '\\') {
             $i++;
             continue;
         }
         if (Lexer::isClosingFor($stack->top(), $c)) {
             $stack->pop();
         } else {
             if (Lexer::isPairingSymbol($c)) {
                 $stack->push($c);
             }
         }
     }
     return $stack->isEmpty() ? $i - $pos : -1;
 }