Skip to content

Commit

Permalink
Conditional comp bits in Cursor.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Apr 14, 2013
1 parent 073363c commit f4d6baa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/QRegex/Cursor.nqp
Expand Up @@ -79,7 +79,12 @@ role NQPCursorRole is export {
$shared := nqp::create(ParseShared);
nqp::bindattr($shared, ParseShared, '$!orig', $orig);
nqp::bindattr_s($shared, ParseShared, '$!target',
#?if parrot
pir::trans_encoding__Ssi($orig, pir::find_encoding__Is('ucs4')));
#?endif
#?if !parrot
$orig);
#?endif
nqp::bindattr_i($shared, ParseShared, '$!highwater', 0);
nqp::bindattr($shared, ParseShared, '@!highexpect', nqp::list_s());
nqp::bindattr($shared, ParseShared, '%!marks', nqp::hash());
Expand Down Expand Up @@ -603,9 +608,16 @@ class NQPMatch is NQPCapture {
method orig() { $!orig }
method to() { $!to }
method CURSOR() { $!cursor }
#?if parrot
method Str() is parrot_vtable('get_string') { nqp::substr($!orig, $!from, $!to-$!from) }
method Int() is parrot_vtable('get_integer') { +self.Str() }
method Num() is parrot_vtable('get_number') { +self.Str() }
#?endif
#?if !parrot
method Str() { nqp::substr($!orig, $!from, $!to-$!from) }
method Int() { +self.Str() }
method Num() { +self.Str() }
#?endif
method Bool() { $!to >= $!from }
method chars() { $!to >= $!from ?? $!to - $!from !! 0 }

Expand Down

0 comments on commit f4d6baa

Please sign in to comment.