@@ -412,45 +412,42 @@ class QRegex::P6Regex::Actions is HLL::Actions {
412
412
else {
413
413
my @ alts ;
414
414
for $ < charspec > {
415
- if $ _ <backslashonly > {
416
- my $ bs := $ _ <backslash >. ast;
417
- $ bs . negate(! $ bs . negate) if $ < sign > eq ' -' ;
418
- @ alts . push ($ bs );
419
- }
420
- elsif $ _ [1 ] {
415
+ if $ _ [1 ] {
421
416
my $ node ;
422
417
my $ lhs ;
423
418
my $ rhs ;
424
419
if $ _ [0 ]<backslash > {
425
- nqp :: say (pir::typeof__sP($ _ [0 ]<backslash >. ast));
426
420
$ node := $ _ [0 ]<backslash >. ast;
427
421
$/ . CURSOR. panic(" Illegal range endpoint in regex: " ~ ~ $ _ )
428
422
if $ node . rxtype ne ' literal' && $ node . rxtype ne ' enumcharlist'
429
423
|| $ node . negate || nqp :: chars ($ node [0 ]) != 1 ;
430
424
$ lhs := $ node [0 ];
431
425
}
432
426
else {
433
- $ lhs := $ _ [0 ][0 ];
427
+ $ lhs := ~ $ _ [0 ][0 ];
434
428
}
435
- if $ _ [1 ]<backslash > {
436
- nqp :: say (pir::typeof__sP($ _ [1 ]<backslash >));
437
- nqp :: say (pir::typeof__sP($ _ [1 ]<backslash >. ast));
438
- $ node := $ _ [1 ]<backslash >. ast;
429
+ if $ _ [1 ][0 ]<backslash > {
430
+ $ node := $ _ [1 ][0 ]<backslash >. ast;
439
431
$/ . CURSOR. panic(" Illegal range endpoint in regex: " ~ ~ $ _ )
440
432
if $ node . rxtype ne ' literal' && $ node . rxtype ne ' enumcharlist'
441
433
|| $ node . negate || nqp :: chars ($ node [0 ]) != 1 ;
442
434
$ rhs := $ node [0 ];
443
435
}
444
436
else {
445
- $ rhs := $ _ [1 ][0 ];
437
+ $ rhs := ~ $ _ [1 ][ 0 ][0 ];
446
438
}
447
439
my $ ord0 := nqp :: ord ($ lhs );
448
440
my $ ord1 := nqp :: ord ($ rhs );
449
441
$/ . CURSOR. panic(" Illegal reversed character range in regex: " ~ ~ $ _ )
450
442
if $ ord0 > $ ord1 ;
451
443
$ str := nqp ::concat($ str , nqp :: chr ($ ord0 ++ )) while $ ord0 <= $ ord1 ;
452
444
}
453
- else { $ str := $ str ~ $ _ [0 ]; }
445
+ elsif $ _ [0 ]<backslash > {
446
+ my $ bs := $ _ [0 ]<backslash >. ast;
447
+ $ bs . negate(! $ bs . negate) if $ < sign > eq ' -' ;
448
+ @ alts . push ($ bs );
449
+ }
450
+ else { $ str := $ str ~ ~ $ _ [0 ]; }
454
451
}
455
452
@ alts . push (QAST ::Regex. new ( $ str , : rxtype<enumcharlist >, : node($/ ), : negate( $ < sign > eq ' -' ) ))
456
453
if nqp :: chars ($ str );
0 commit comments