Permalink
Browse files

add indirection for 'Unrecognized backslash sequence'

  • Loading branch information...
1 parent c0ddc72 commit e9ab3125e86bee7cb4bd836571f0b1808bc79ec9 @FROGGS FROGGS committed Nov 26, 2012
Showing with 6 additions and 2 deletions.
  1. +5 −1 src/HLL/Grammar.pm
  2. +1 −1 src/QRegex/P6Regex/Grammar.nqp
View
@@ -4,6 +4,10 @@ grammar HLL::Grammar {
my $brackets := "<>[]()\{}\xab\xbb\x[0f3a]\x[0f3b]\x[0f3c]\x[0f3d]\x[169b]\x[169c]\x[2045]\x[2046]\x[207d]\x[207e]\x[208d]\x[208e]\x[2329]\x[232a]\x[2768]\x[2769]\x[276a]\x[276b]\x[276c]\x[276d]\x[276e]\x[276f]\x[2770]\x[2771]\x[2772]\x[2773]\x[2774]\x[2775]\x[27c5]\x[27c6]\x[27e6]\x[27e7]\x[27e8]\x[27e9]\x[27ea]\x[27eb]\x[2983]\x[2984]\x[2985]\x[2986]\x[2987]\x[2988]\x[2989]\x[298a]\x[298b]\x[298c]\x[298d]\x[298e]\x[298f]\x[2990]\x[2991]\x[2992]\x[2993]\x[2994]\x[2995]\x[2996]\x[2997]\x[2998]\x[29d8]\x[29d9]\x[29da]\x[29db]\x[29fc]\x[29fd]\x[3008]\x[3009]\x[300a]\x[300b]\x[300c]\x[300d]\x[300e]\x[300f]\x[3010]\x[3011]\x[3014]\x[3015]\x[3016]\x[3017]\x[3018]\x[3019]\x[301a]\x[301b]\x[301d]\x[301e]\x[fd3e]\x[fd3f]\x[fe17]\x[fe18]\x[fe35]\x[fe36]\x[fe37]\x[fe38]\x[fe39]\x[fe3a]\x[fe3b]\x[fe3c]\x[fe3d]\x[fe3e]\x[fe3f]\x[fe40]\x[fe41]\x[fe42]\x[fe43]\x[fe44]\x[fe47]\x[fe48]\x[fe59]\x[fe5a]\x[fe5b]\x[fe5c]\x[fe5d]\x[fe5e]\x[ff08]\x[ff09]\x[ff3b]\x[ff3d]\x[ff5b]\x[ff5d]\x[ff5f]\x[ff60]\x[ff62]\x[ff63]";
my $cursor_class := NQPCursor;
+ method throw_unrecog_backslash_seq ($sequence) {
+ self.panic("Unrecognized backslash sequence: '\\" ~ $sequence ~ "'");
+ }
+
token termish {
<prefixish>*
<term>
@@ -102,7 +106,7 @@ grammar HLL::Grammar {
|| <?quotemod_check('b')>
[
| $<textqq>=(\W)
- | $<x>=[\w] { $/.CURSOR.panic("Unrecognized backslash sequence: '\\" ~ $<x>.Str ~ "'") }
+ | (\w) { self.throw_unrecog_backslash_seq: $/[0].Str }
]
|| $<textq>=[.]
]
@@ -237,7 +237,7 @@ grammar QRegex::P6Regex::Grammar is HLL::Grammar {
token backslash:sym<z> { 'z' <.obs: '\\z as end-of-string matcher', '$'> }
token backslash:sym<Z> { 'Z' <.obs: '\\Z as end-of-string matcher', '\\n?$'> }
token backslash:sym<Q> { 'Q' <.obs: '\\Q as quotemeta', 'quotes or literal variable match'> }
- token backslash:sym<unrec> { {} \w <.panic: 'Unrecognized backslash sequence'> }
+ token backslash:sym<unrec> { {} (\w) { self.throw_unrecog_backslash_seq: $/[0].Str } }
token backslash:sym<misc> { \W }
proto token assertion { <...> }

0 comments on commit e9ab312

Please sign in to comment.