@@ -451,19 +451,23 @@ class QRegex::P6Regex::Actions is HLL::Actions {
451
451
method cclass_backslash :sym <o >($/ ) {
452
452
my $ octlit :=
453
453
HLL::Actions. ints_to_string( $ < octint > || $ < octints >< octint > );
454
- make $ < sym > eq ' O'
454
+ my $ ast := $ < sym > eq ' O'
455
455
?? QAST ::Regex. new ( $ octlit , : rxtype(' enumcharlist' ),
456
456
: negate(1 ), : node($/ ) )
457
457
!! QAST ::Regex. new ( $ octlit , : rxtype(' literal' ), : node($/ ) );
458
+ $ ast . annotate(' codepoint' , $ < octint > ?? $ < octint > . ast !! $ < octints >< octint > [0 ]. ast);
459
+ make $ ast ;
458
460
}
459
461
460
462
method cclass_backslash :sym <x >($/ ) {
461
463
my $ hexlit :=
462
464
HLL::Actions. ints_to_string( $ < hexint > || $ < hexints >< hexint > );
463
- make $ < sym > eq ' X'
465
+ my $ ast := $ < sym > eq ' X'
464
466
?? QAST ::Regex. new ( $ hexlit , : rxtype(' enumcharlist' ),
465
467
: negate(1 ), : node($/ ) )
466
468
!! QAST ::Regex. new ( $ hexlit , : rxtype(' literal' ), : node($/ ) );
469
+ $ ast . annotate(' codepoint' , $ < hexint > ?? $ < hexint > . ast !! $ < hexints >< hexint > [0 ]. ast);
470
+ make $ ast ;
467
471
}
468
472
469
473
method cclass_backslash :sym <c >($/ ) {
@@ -645,30 +649,28 @@ class QRegex::P6Regex::Actions is HLL::Actions {
645
649
for $ < charspec > {
646
650
if $ _ [1 ] {
647
651
my $ node ;
648
- my $ lhs ;
649
- my $ rhs ;
652
+ my $ ord0 ;
653
+ my $ ord1 ;
650
654
if $ _ [0 ]<cclass_backslash > {
651
655
$ node := $ _ [0 ]<cclass_backslash >. ast;
652
656
$/ . CURSOR. panic(" Illegal range endpoint in regex: " ~ ~ $ _ )
653
657
if $ node . rxtype ne ' literal' && $ node . rxtype ne ' enumcharlist'
654
658
|| $ node . negate || nqp :: chars ($ node [0 ]) != 1 ;
655
- $ lhs := $ node [0 ];
659
+ $ ord0 := $ node . ann( ' codepoint ' ) // nqp :: ord ( $ node [0 ]) ;
656
660
}
657
661
else {
658
- $ lhs := ~ $ _ [0 ][0 ];
662
+ $ ord0 := nqp :: ord ( ~ $ _ [0 ][0 ]) ;
659
663
}
660
664
if $ _ [1 ][0 ]<cclass_backslash > {
661
665
$ node := $ _ [1 ][0 ]<cclass_backslash >. ast;
662
666
$/ . CURSOR. panic(" Illegal range endpoint in regex: " ~ ~ $ _ )
663
667
if $ node . rxtype ne ' literal' && $ node . rxtype ne ' enumcharlist'
664
668
|| $ node . negate || nqp :: chars ($ node [0 ]) != 1 ;
665
- $ rhs := $ node [0 ];
669
+ $ ord1 := $ node . ann( ' codepoint ' ) // nqp :: ord ( $ node [0 ]) ;
666
670
}
667
671
else {
668
- $ rhs := ~ $ _ [1 ][0 ][0 ];
672
+ $ ord1 := nqp :: ord ( ~ $ _ [1 ][0 ][0 ]) ;
669
673
}
670
- my $ ord0 := nqp :: ord ($ lhs );
671
- my $ ord1 := nqp :: ord ($ rhs );
672
674
$/ . CURSOR. panic(" Illegal reversed character range in regex: " ~ ~ $ _ )
673
675
if $ ord0 > $ ord1 ;
674
676
@ alts . push (QAST ::Regex. new (
0 commit comments