/** * This method return a tuple representing the token discovered. * * @access public * @param \Unicity\IO\Reader $reader the reader to be used * @return \Unicity\Lexer\Scanner\Tuple a tuple representing the token * discovered */ public function process(IO\Reader $reader) { $index = $reader->position(); $char = $reader->readChar($index, false); if ($char == $this->quotation) { $lookahead = $index + 1; $length = $reader->length() - 1; while ($lookahead <= $length) { if ($reader->readChar($lookahead, false) == $this->quotation) { if ($lookahead == $length || $reader->readChar($lookahead + 1, false) != $this->quotation) { $lookahead++; break; } $lookahead++; } $lookahead++; } $token = $reader->readRange($index, $lookahead); $tuple = new Lexer\Scanner\Tuple(Lexer\Scanner\TokenType::literal(), new Common\String($token)); return $tuple; } return null; }