Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change semantics of :b quoter tweak
Fixes 127226: https://rt.perl.org/Ticket/Display.html?id=127226

Make it more aggressive and behave like backslashes behave in `qq`
quoter: throwing on any unrecognized backslash sequences and
giving the \W itself when an unknown \W is backslashed.

This makes Q:b combined with other tweaks, e.g. :s, behave more
consistently in that both `Q:b/\$foo/` and `Q:b:s/\$foo/` would
result in string `$foo`.
  • Loading branch information
zoffixznet committed Jan 30, 2018
1 parent 2c36ab2 commit deffe54
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Perl6/Grammar.nqp
Expand Up @@ -5074,6 +5074,8 @@ grammar Perl6::QGrammar is HLL::Grammar does STD {
token backslash:sym<x> { :dba('hex character') <sym> [ <hexint> | '[' ~ ']' <hexints> | '{' <.obsbrace> ] }
token backslash:sym<0> { <sym> }
token backslash:sym<1> { <[1..9]>\d* {} <.sorry("Unrecognized backslash sequence (did you mean \${$/ - 1}?)")> }
token backslash:sym<unrec> { {} (\w) { self.throw_unrecog_backslash_seq: $/[0].Str } }
token backslash:sym<misc> { \W }
}
role b0 {
Expand Down Expand Up @@ -5176,9 +5178,6 @@ grammar Perl6::QGrammar is HLL::Grammar does STD {
role qq does b1 does c1 does s1 does a1 does h1 does f1 {
token starter { \" }
token stopper { \" }
token backslash:sym<unrec> { {} (\w) { self.throw_unrecog_backslash_seq: $/[0].Str } }
token backslash:sym<misc> { \W }
method tweak_q($v) { self.panic("Too late for :q") }
method tweak_qq($v) { self.panic("Too late for :qq") }
}
Expand Down

0 comments on commit deffe54

Please sign in to comment.