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

When inside single quotes, Perl tokenizes \ as an error #1163

Closed
miparnisari opened this issue Jun 10, 2019 · 3 comments · Fixed by #1549
Closed

When inside single quotes, Perl tokenizes \ as an error #1163

miparnisari opened this issue Jun 10, 2019 · 3 comments · Fixed by #1549
Assignees
Labels
bugfix-request A request for a bugfix to be developed.

Comments

@miparnisari
Copy link
Contributor

Problem:

image

I tried adding the following rule as the 3rd rule of states :sq and :dq and it fixes it, but of course IDK if this is the right solution.

      state :sq do
        rule /\\[']/, Str::Escape
        rule /[^\\']+/, Str::Single
+        rule /\\/, Str::Single
        rule /'/, Punctuation, :pop!
      end

      state :dq do
        mixin :string_intp
        rule /\\[\\tnr"]/, Str::Escape
        rule /[^\\"]+?/, Str::Double
+        rule /\\/, Str::Single
        rule /"/, Punctuation, :pop!
      end

image

@pyrmont
Copy link
Contributor

pyrmont commented Jun 10, 2019

B'oh—well that's a silly mistake.

I think the fix for :sq is right but I'm less sure about :dq. When I try a very rudimentary print statement at the command line with Perl then passing a double-quoted string with a single backslash omits from the output the character that was escaped.

So we probably want to highlight both the backslash and the immediately following character with the Str::Escape token.

@pyrmont pyrmont added the bugfix-request A request for a bugfix to be developed. label Jun 10, 2019
@stale
Copy link

stale bot commented Jun 9, 2020

This issue has been automatically marked as stale because it has not had any activity for more than a year. It will be closed if no additional activity occurs within the next 14 days.
If you would like this issue to remain open, please reply and let us know if the issue is still reproducible.

@stale stale bot added stale-issue There has been no activity for a year. and removed stale-issue There has been no activity for a year. labels Jun 9, 2020
@pyrmont pyrmont self-assigned this Jun 19, 2020
@pyrmont
Copy link
Contributor

pyrmont commented Jun 19, 2020

I should be able to fix this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix-request A request for a bugfix to be developed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants