Changeset 6109 for src/RRegex/PCRE.hs

Show
Ignore:
Timestamp:
08/07/05 20:12:10 (3 years ago)
Author:
putter
Message:

PCRE :global rules, without a subpattern, now return the correct match array. my @a = 'aaa' rx:perl5:g/a/; +@a #=> 3, not 0. PGE rules are not fixed, awaiting a way to determine if they contain a subpattern. Match .from and .to still incorrect. The patch is a bit messy. This would all be better handled by p6-side analysis and implementation of :global.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/RRegex/PCRE.hs

    r3372 r6109  
    2323    pcreUtf8,       --  UTF-8 semantics 
    2424     
     25    numSubs, 
     26 
    2527    getVersion 
    2628    ) where 
     
    5961            return $ Left (fi eo,es) 
    6062          else fmap (Right . Regex) (newForeignPtr_ v) 
     63 
     64numSubs :: Regex -> IO Int 
     65numSubs (Regex pcre_fptr) = withForeignPtr pcre_fptr $ \pcre_ptr -> do 
     66    nsub <- getNumSubs pcre_ptr  
     67    return $ fromIntegral nsub 
    6168 
    6269getNumSubs :: Ptr PCRE -> IO CInt