php-parser icon indicating copy to clipboard operation
php-parser copied to clipboard

Fix problem with heredoc parsing \n as newlines, not as literal string

Open cseufert opened this issue 1 year ago • 1 comments

I am trying to fox #1130 however need some help with this one, for the prettier plugin we want to keep the original intent, and not parse the \n as a newline, so we can rebuild the original string in the output.

Do I create a special AST token for \n in a HEREDOC, or should ignore the \n as a special case, and parse it as a regular string?

cseufert avatar Mar 08 '24 06:03 cseufert

Hmm, I don't have any intuition on this. Might be worth checking how this is handled in https://github.com/nikic/PHP-Parser?

czosel avatar Mar 08 '24 07:03 czosel