File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ grammar QRegex::P6Regex::Grammar is HLL::Grammar {
44
44
~ ~ $ when ~ ' please use ' ~ ~ $ new );
45
45
}
46
46
47
+ method throw_unrecognized_metachar ($ char ) {
48
+ self . panic(' Unrecognized regex metacharacter ' ~ $ char ~ ' (must be quoted to match literally)' );
49
+ }
50
+
47
51
token ws { [ \s + | '#' \N * ]* }
48
52
49
53
token normspace { <? before \s | '#' > <.ws > }
@@ -78,7 +82,7 @@ grammar QRegex::P6Regex::Grammar is HLL::Grammar {
78
82
[
79
83
|| <?infixstopper >
80
84
|| $$ <.panic : "Regex not terminated" >
81
- || (\W ) { $/ . CURSOR . panic( " Unrecognized regex metacharacter " ~ $/ [0 ]. Str ~ " (must be quoted to match literally) " ) }
85
+ || (\W ) { self . throw_unrecognized_metachar : ~ $/ [0 ] }
82
86
|| <.panic : "Regex not terminated" >
83
87
]
84
88
}
@@ -116,10 +120,7 @@ grammar QRegex::P6Regex::Grammar is HLL::Grammar {
116
120
117
121
token termish {
118
122
|| <noun = .quantified_atom >+
119
- || (\W ) {
120
- my $ char := ~ $/ [0 ];
121
- $/ . CURSOR. panic(" Unrecognized regex metacharacter $ char (must be quoted to match literally)" )
122
- }
123
+ || (\W ) { self . throw_unrecognized_metachar: ~ $/ [0 ] }
123
124
}
124
125
125
126
token quantified_atom {
You can’t perform that action at this time.
0 commit comments