"The UCHAR types define unsigned code units of the appropriate widths.
For example, PCRE2_UCHAR16 is usually defined as uint16_t."
Modulepcre2-2.2.1Haskell2010
Text.Regex.Pcre2.Foreign
A complete binding to the low-level C API.
Items here are named identically to their C counterparts. Therefore, documentation will be sparse; the official PCRE2 API docs should suffice.
- 12 types
- 242 values
- Packagepcre2-2.2.1
- Exports254
- LanguageHaskell2010
- LicenceApache-2.0
- SourceForeign.hs
Types
3 declarations"The SPTR types are constant pointers to the equivalent UCHAR types,
that is, they are pointers to vectors of unsigned code units."
"...string lengths and offsets into strings of code units...are always of
type PCRE2_SIZE...currently always defined as size_t."
Opaque types
These correspond to structs that are only ever passed by reference. They simply exist for type safety and cannot be constructed in Haskell.
The general context
3 declarationsThe compile context
3 declarationsCompile context setters
pcre2_set_compile_extra_options :: Ptr Pcre2_compile_context-> CUIntSee "Extra compile options" below for possible bit flags.
-> IO CInt
The match context
3 declarationsMatch context setters
pcre2_set_offset_limit :: Ptr Pcre2_match_context-> PCRE2_SIZECan be unset. See below.
-> IO CInt
Checking build-time options
17 declarationsCompiling a pattern
5 declarationspcre2_compile :: PCRE2_SPTR-> PCRE2_SIZECan be zero-terminated. See below.
-> CUIntSee "Main compile options" below for possible bit flags.
-> Ptr CInt-> Ptr PCRE2_SIZE-> Ptr Pcre2_compile_context-> IO (Ptr Pcre2_code)
Main compile options
Extra compile options
JIT compilation
10 declarationsMay be returned by pcre2_jit_compile.
pcre2_jit_match :: Ptr Pcre2_code-> PCRE2_SPTRsubject
-> PCRE2_SIZElength
-> PCRE2_SIZEstartoffset
-> CUIntoptions
-> Ptr Pcre2_match_data-> Ptr Pcre2_match_context-> IO CInt
Locale support
2 declarationsInformation about a compiled pattern
29 declarationspcre2_pattern_info Duplicate capture group names
pcre2_substring_nametable_scan :: Ptr Pcre2_code-> PCRE2_SPTRname
-> Ptr PCRE2_SPTRfirst
-> Ptr PCRE2_SPTRlast
-> IO CInt
Callouts
1 declarationCallout struct getters
These functions are not part of the official API; we provide them here. C API consumers are supposed to access struct fields directly, but the FFI cannot yet do that as of GHC 8.8.4.
pcre2_callout_block
See below for possible bit flags.
pcre2_callout_enumerate_block
pcre2_substitute_callout_block
Array of 2 (PCRE2_SIZE[2])
The match data block
3 declarationspcre2_match_data_create :: CUIntovecsize
-> Ptr Pcre2_general_context-> IO (Ptr Pcre2_match_data)
Matching a pattern
1 declarationpcre2_match :: Ptr Pcre2_code-> PCRE2_SPTRsubject
-> PCRE2_SIZElength
-> PCRE2_SIZEstartoffset
-> CUIntSee below for possible bit flags.
-> Ptr Pcre2_match_data-> Ptr Pcre2_match_context-> IO CInt
Match options
Match errors
UTF-16-specific errors
"Missing low surrogate at end of string"
"Invalid low surrogate follows high surrogate"
"Isolated low surrogate"
DFA matching
1 declarationpcre2_dfa_match :: Ptr Pcre2_code-> PCRE2_SPTRsubject
-> PCRE2_SIZElength
-> PCRE2_SIZEstartoffset
-> CUIntoptions
-> Ptr Pcre2_match_data-> Ptr Pcre2_match_context-> Ptr CIntworkspace
-> PCRE2_SIZEwscount
-> IO CInt
DFA matching options
DFA matching errors
Returned string and captured substrings
15 declarationspcre2_substring_length_bynumber :: Ptr Pcre2_match_data-> CUIntnumber
-> Ptr PCRE2_SIZElength
-> IO CInt
pcre2_substring_copy_bynumber :: Ptr Pcre2_match_data-> CUIntnumber
-> Ptr PCRE2_UCHARbuffer
-> Ptr PCRE2_SIZEbufflen
-> IO CInt
pcre2_substring_get_bynumber :: Ptr Pcre2_match_data-> CUIntname
-> Ptr (Ptr PCRE2_UCHAR)bufferptr
-> Ptr PCRE2_SIZEbufflen
-> IO CInt
pcre2_substring_list_get :: Ptr Pcre2_match_data-> Ptr (Ptr (Ptr PCRE2_UCHAR))listptr
-> Ptr (Ptr PCRE2_SIZE)lengthsptr
-> IO CInt
pcre2_substring_length_byname :: Ptr Pcre2_match_data-> PCRE2_SPTRname
-> Ptr PCRE2_SIZElength
-> IO CInt
pcre2_substring_copy_byname :: Ptr Pcre2_match_data-> PCRE2_SPTRname
-> Ptr PCRE2_UCHARbuffer
-> Ptr PCRE2_SIZEbufflen
-> IO CInt
pcre2_substring_get_byname :: Ptr Pcre2_match_data-> PCRE2_SPTRname
-> Ptr (Ptr PCRE2_UCHAR)bufferptr
-> Ptr PCRE2_SIZEbufflen
-> IO CInt
Creating a new string with substitutions
1 declarationpcre2_substitute :: Ptr Pcre2_code-> PCRE2_SPTRsubject
-> PCRE2_SIZElength
-> PCRE2_SIZEstartoffset
-> CUIntoptions
-> Ptr Pcre2_match_data-> Ptr Pcre2_match_context-> PCRE2_SPTRreplacement
-> PCRE2_SIZErlength
-> Ptr PCRE2_UCHARoutputbuffer
-> Ptr PCRE2_SIZEoutlengthptr
-> IO CInt
Substitution options
Substitution errors
Other information about a match
2 declarationsObtaining a textual error message
1 declarationPattern serialization
6 declarationspcre2_serialize_decode :: Ptr (Ptr Pcre2_code)codes
-> CIntnumber of codes
-> Ptr CUIntbytes
-> Ptr Pcre2_general_context-> IO CInt
pcre2_serialize_encode :: Ptr (Ptr Pcre2_code)codes
-> CIntnumber of codes
-> Ptr (Ptr CUInt)serialized bytes
-> Ptr PCRE2_SIZEserialized size
-> Ptr Pcre2_general_context-> IO CInt