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

Backslashes not handled correctly in strings #23

Closed
masak opened this issue Oct 7, 2015 · 0 comments
Closed

Backslashes not handled correctly in strings #23

masak opened this issue Oct 7, 2015 · 0 comments

Comments

@masak
Copy link
Owner

masak commented Oct 7, 2015

The following are right:

$ perl6 bin/007 -e='say("OH HAI")'
OH HAI
$ perl6 bin/007 -e='say(chars("OH HAI"))'
6

And these are all wrong:

$ perl6 bin/007 -e='say("OH \"HAI")'
OH \"HAI
$ perl6 bin/007 -e='say(chars("OH \"HAI"))'
8
$ perl6 bin/007 -e='say("OH \\HAI")'
OH \\HAI
$ perl6 bin/007 -e='say(chars("OH \\HAI"))'
8

(With my expectations being OH "HAI, 7, OH \HAI, 7.)

The simplest hypothesis that fits the data is that we correctly parse backslashes in strings, but we don't un-escape them correctly when we store them as values.

@masak masak closed this as completed in d887a54 Oct 14, 2015
vendethiel pushed a commit to vendethiel/007 that referenced this issue Oct 20, 2015
First tried to do it in the term:str action method, but the test
suite wouldn't let me. :) This started failing:

    t/integration/corner-cases.t ... 10/?
    # Failed test 'can escape quotes inside string'
    # at /home/masak/ours/007/lib/_007/Test.pm line 201
    # expected: ''
    #      got: '@@ -4,3 +4,3 @@
    #        Identifier[say]
    #        Arguments
    # -        Str["\""]
    # +        Str["""]
    # '

Because Q::Literal::Str represents the code view of things, and
the code clearly still has the backslash.

Thank you, test.

Closes masak#23.
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