Skip to content

Commit bf1d2ad

Browse files
committed
Implement <.print> and <.graph> rules.
1 parent 8304e17 commit bf1d2ad

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/QRegex/Cursor.nqp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,15 @@ role NQPCursorRole is export {
716716
$cur;
717717
}
718718

719+
method print() {
720+
my $cur := self."!cursor_start_cur"();
721+
my str $target := nqp::getattr_s($!shared, ParseShared, '$!target');
722+
$cur."!cursor_pass"($!pos+1, 'print')
723+
if $!pos < nqp::chars($target)
724+
&& nqp::iscclass(nqp::const::CCLASS_PRINTING, $target, $!pos);
725+
$cur;
726+
}
727+
719728
method cntrl() {
720729
my $cur := self."!cursor_start_cur"();
721730
my str $target := nqp::getattr_s($!shared, ParseShared, '$!target');
@@ -734,6 +743,16 @@ role NQPCursorRole is export {
734743
$cur;
735744
}
736745

746+
method graph() {
747+
my $cur := self."!cursor_start_cur"();
748+
my str $target := nqp::getattr_s($!shared, ParseShared, '$!target');
749+
$cur."!cursor_pass"($!pos+1, 'graph')
750+
if $!pos < nqp::chars($target)
751+
&& (nqp::iscclass(nqp::const::CCLASS_ALPHANUMERIC, $target, $!pos)
752+
|| nqp::iscclass(nqp::const::CCLASS_PUNCTUATION, $target, $!pos));
753+
$cur;
754+
}
755+
737756
method FAILGOAL($goal, $dba?) {
738757
self."!cursor_start_cur"()
739758
}

0 commit comments

Comments
 (0)