Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heredocs get tabs removed when asked to dedent whitespace #3299

Closed
p6rt opened this issue Dec 29, 2013 · 4 comments
Closed

heredocs get tabs removed when asked to dedent whitespace #3299

p6rt opened this issue Dec 29, 2013 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Dec 29, 2013

Migrated from rt.perl.org#120895 (status was 'resolved')

Searchable as RT120895$

@p6rt
Copy link
Author

p6rt commented Dec 29, 2013

From @FROGGS

<FROGGS> p​: say qq​:to/EOF/ ~~ /\t/;␤\thello␤EOF␤# the tab is preserved
<camelia> rakudo-parrot c14a84​: OUTPUT«「 」␤␤»
<FROGGS> p​: say qq​:to/EOF/ ~~ /\t/;␤ \thello␤ EOF␤# now it is gone
<camelia> rakudo-parrot c14a84​: OUTPUT«Nil␤»

In the second example it is meant to strip four space chars, but additionally it converts the tabs to space chars. Which is bad for e.g. Makefiles.

@p6rt
Copy link
Author

p6rt commented Jan 4, 2014

From @masak

On Sun Dec 29 08​:24​:44 2013, FROGGS.de wrote​:

<FROGGS> p​: say qq​:to/EOF/ ~~ /\t/;␤\thello␤EOF␤# the tab is preserved
<camelia> rakudo-parrot c14a84​: OUTPUT«「 」␤␤»
<FROGGS> p​: say qq​:to/EOF/ ~~ /\t/;␤ \thello␤ EOF␤# now it is
gone
<camelia> rakudo-parrot c14a84​: OUTPUT«Nil␤»

In the second example it is meant to strip four space chars, but
additionally it converts the tabs to space chars. Which is bad for
e.g. Makefiles.

I agree. S32/Str is a bit vague about what to do in this case. It talks about different policies (spaces only, only some other \h char, or mixed types) when *adding* spaces, but it doesn't mention what to do when removing spaces.

I'm fine with clarifying the spec, as long as we err on the side of sanity/consistency. Feel free to run any patches through me for review.

@p6rt
Copy link
Author

p6rt commented Nov 12, 2015

From @jnthn

On Sat Jan 04 02​:26​:52 2014, masak wrote​:

On Sun Dec 29 08​:24​:44 2013, FROGGS.de wrote​:

<FROGGS> p​: say qq​:to/EOF/ ~~ /\t/;␤\thello␤EOF␤# the tab is
preserved
<camelia> rakudo-parrot c14a84​: OUTPUT«「 」␤␤»
<FROGGS> p​: say qq​:to/EOF/ ~~ /\t/;␤ \thello␤ EOF␤# now it is
gone
<camelia> rakudo-parrot c14a84​: OUTPUT«Nil␤»

In the second example it is meant to strip four space chars, but
additionally it converts the tabs to space chars. Which is bad for
e.g. Makefiles.

I agree. S32/Str is a bit vague about what to do in this case. It
talks about different policies (spaces only, only some other \h char,
or mixed types) when *adding* spaces, but it doesn't mention what to
do when removing spaces.

I'm fine with clarifying the spec, as long as we err on the side of
sanity/consistency. Feel free to run any patches through me for
review.

TimToady++ confirmed that \t falls under the same rule as \r, \n, and so forth - that is, we should be interpolating it after considering the dedent. I've implemented that now, and it's tested in S02-literals/quoting.t.

/jnthn

@p6rt p6rt closed this as completed Nov 12, 2015
@p6rt
Copy link
Author

p6rt commented Nov 12, 2015

@jnthn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant