Esempio n. 1
0
 /**
  * @param Token $token
  * @param string $type
  * @param int $position
  * @return Token
  */
 protected function splitToken(Token $token, $type, $position)
 {
     $value = $token->value();
     if (strlen($value) > $position) {
         $offset = $token->offset() + $position;
         $head = substr($value, 0, $position);
         $tail = Token::bit($type, substr($value, $position), $offset);
         $this->putBack($tail);
         $token->set($type, $head)->set(0, $head);
     }
     return $token;
 }