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

Misleading error in tr/// when including a # character #2118

Closed
jmaslak opened this issue Jul 22, 2018 · 2 comments · Fixed by Raku/roast#744
Closed

Misleading error in tr/// when including a # character #2118

jmaslak opened this issue Jul 22, 2018 · 2 comments · Fixed by Raku/roast#744
Labels
regex Regular expressions, pattern matching, user-defined grammars, tokens and rules smartmatch Smart matching with ~~ and .ACCEPTS methods tests needed Issue is generally resolved but tests were not written yet transliteration

Comments

@jmaslak
Copy link
Contributor

jmaslak commented Jul 22, 2018

The Problem

Misleading error message for # in a tr/TR.

The error message indicates "Please backslash # for literal char or put whitespace in front for comment".

However, adding a backslash just generates the same error message.

Expected Behavior

I'm not entirely sure what the proper behavior of a backslash in a TR should be. When working on #2117, I was trying to generate errors based on unrecognized backslash sequences to test the PR, but was not able to trigger that condition.

My expectations (which may be wrong) would be that either the backslash in front of # should work and quiet this error or the error message should be changed.

Actual Behavior

Without backslash:

[1] red:rakudo$ perl6 -e '1 ~~ TR/#//'
===SORRY!=== Error while compiling -e
Please backslash # for literal char or put whitespace in front for comment
at -e:1
------> 1 ~~ TR/#⏏//

With backslash:

[1] red:rakudo$ perl6 -e '1 ~~ TR/\#//'
===SORRY!=== Error while compiling -e
Please backslash # for literal char or put whitespace in front for comment
at -e:1
------> 1 ~~ TR/\#⏏//

Steps to Reproduce

See above.

Environment

  • Operating system: Ubuntu 18.04
  • Compiler version (perl6 -v): HEAD & 18.06
@zoffixznet
Copy link
Contributor

Related ticket: #1324

@lucasbuchala lucasbuchala added regex Regular expressions, pattern matching, user-defined grammars, tokens and rules smartmatch Smart matching with ~~ and .ACCEPTS methods transliteration labels Mar 15, 2019
@dogbert17
Copy link

dogbert17 commented Nov 2, 2019

The error message for the backslash case is gone as of 85107ec

@Altai-man Altai-man added the tests needed Issue is generally resolved but tests were not written yet label Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regex Regular expressions, pattern matching, user-defined grammars, tokens and rules smartmatch Smart matching with ~~ and .ACCEPTS methods tests needed Issue is generally resolved but tests were not written yet transliteration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants