| @@ 391-419 (lines=29) @@ | ||
| 388 | * |
|
| 389 | * @throws JSMin_UnterminatedCommentException |
|
| 390 | */ |
|
| 391 | protected function consumeMultipleLineComment() |
|
| 392 | {
|
|
| 393 | $this->get(); |
|
| 394 | $comment = ''; |
|
| 395 | for(;;) {
|
|
| 396 | $get = $this->get(); |
|
| 397 | if ($get === '*') {
|
|
| 398 | if ($this->peek() === '/') { // end of comment reached
|
|
| 399 | $this->get(); |
|
| 400 | if (0 === strpos($comment, '!')) {
|
|
| 401 | // preserved by YUI Compressor |
|
| 402 | if (!$this->keptComment) {
|
|
| 403 | // don't prepend a newline if two comments right after one another |
|
| 404 | $this->keptComment = "\n"; |
|
| 405 | } |
|
| 406 | $this->keptComment .= "/*!" . substr($comment, 1) . "*/\n"; |
|
| 407 | } else if (preg_match('/^@(?:cc_on|if|elif|else|end)\\b/', $comment)) {
|
|
| 408 | // IE conditional |
|
| 409 | $this->keptComment .= "/*{$comment}*/";
|
|
| 410 | } |
|
| 411 | return; |
|
| 412 | } |
|
| 413 | } elseif ($get === null) {
|
|
| 414 | throw new JSMin_UnterminatedCommentException( |
|
| 415 | "JSMin: Unterminated comment at byte {$this->inputIndex}: /*{$comment}");
|
|
| 416 | } |
|
| 417 | $comment .= $get; |
|
| 418 | } |
|
| 419 | } |
|
| 420 | ||
| 421 | /** |
|
| 422 | * Get the next character, skipping over comments. Some comments may be preserved. |
|
| @@ 401-429 (lines=29) @@ | ||
| 398 | * |
|
| 399 | * @throws JSMin_UnterminatedCommentException |
|
| 400 | */ |
|
| 401 | protected function consumeMultipleLineComment() |
|
| 402 | { |
|
| 403 | $this->get(); |
|
| 404 | $comment = ''; |
|
| 405 | for(;;) { |
|
| 406 | $get = $this->get(); |
|
| 407 | if ($get === '*') { |
|
| 408 | if ($this->peek() === '/') { // end of comment reached |
|
| 409 | $this->get(); |
|
| 410 | if (0 === strpos($comment, '!')) { |
|
| 411 | // preserved by YUI Compressor |
|
| 412 | if (!$this->keptComment) { |
|
| 413 | // don't prepend a newline if two comments right after one another |
|
| 414 | $this->keptComment = "\n"; |
|
| 415 | } |
|
| 416 | $this->keptComment .= "/*!" . substr($comment, 1) . "*/\n"; |
|
| 417 | } else if (preg_match('/^@(?:cc_on|if|elif|else|end)\\b/', $comment)) { |
|
| 418 | // IE conditional |
|
| 419 | $this->keptComment .= "/*{$comment}*/"; |
|
| 420 | } |
|
| 421 | return; |
|
| 422 | } |
|
| 423 | } elseif ($get === null) { |
|
| 424 | throw new JSMin_UnterminatedCommentException( |
|
| 425 | "JSMin: Unterminated comment at byte {$this->inputIndex}: /*{$comment}"); |
|
| 426 | } |
|
| 427 | $comment .= $get; |
|
| 428 | } |
|
| 429 | } |
|
| 430 | ||
| 431 | /** |
|
| 432 | * Get the next character, skipping over comments. Some comments may be preserved. |
|