From f4d6baad5456144c1d88b7ff56d451f7de7afa00 Mon Sep 17 00:00:00 2001 From: jnthn Date: Sun, 14 Apr 2013 21:55:57 +0200 Subject: [PATCH] Conditional comp bits in Cursor. --- src/QRegex/Cursor.nqp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/QRegex/Cursor.nqp b/src/QRegex/Cursor.nqp index 67837e7197..1e16fa6211 100755 --- a/src/QRegex/Cursor.nqp +++ b/src/QRegex/Cursor.nqp @@ -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()); @@ -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 }