Skip to content

Commit

Permalink
feat(comment): support literal LF char inside string
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Apr 8, 2021
1 parent cf79981 commit edfa29b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ protected function reset()
protected function doStrip(string $json): string
{
$return = '';
$crlf = ["\n" => '\n', "\r" => '\r'];

while (isset($json[++$this->index])) {
list($prev, $char, $next) = $this->getSegments($json);

$return = $this->checkTrail($char, $return);

if ($this->inStringOrCommentEnd($prev, $char, $char . $next)) {
$return .= $char;
$return .= $this->inStr && isset($crlf[$char]) ? $crlf[$char] : $char;

continue;
}
Expand Down

0 comments on commit edfa29b

Please sign in to comment.