ATSLIB/contrib/pcre/pcre_ML
This package contains an API in ATS of quasi ML-style that is
directly based on the pcre package.
Synopsis
fun{
} regstr_match_string
(regstr: string, subject: string): int
Description
Given a pcre-style regular expression (represented as a string) and a
subject string, this function tests whether the subject string contains a
portion that matches the given regular expression.
Return Value
The function returns 0 to indicate that a match is found. Otherwise, it
returns a negative integer to indicate its failure in finding a match. Note
that a failure may also mean that the given regular expression is
ill-formed.
Synopsis
fun{
} regstr_match_substring
{n:int}{st,ln:int | st+ln <= n}
(
regstr: string
, subject: string(n), st: size_t st, ln: size_t ln
) : int
Description
This function is a slightly generalized variant of regstr_match_string.
Synopsis
fun{
} regstr_match2_string{n:int}
(
regstr: string, subject: string(n)
, matched_beg: &int? >> int(n0), matched_end: &int? >> int(n1)
) : #[n0,n1:int | n0 <= n1; n1 <= n] int
Description
Compared with regstr_match_string, this function takes two
additional call-by-reference arguments that are used to store the beginning
and ending positions of the portion of the given subject string that
matches the given regular expression.
Synopsis
fun{
} regstr_match2_substring
{n:int}{st,ln:int | st+ln <= n}
(
regstr: string
, subject: string(n), st: size_t st, ln: size_t ln
, matched_beg: &int? >> int(n0), matched_end: &int? >> int(n1)
) : #[n0,n1:int | n0 <= n1; n1 <= st+ln] int
Description
This function is a slightly generalized variant of regstr_match2_string.
Synopsis
fun{
} regstr_match3_string
{n:int}
(
regstr: string
, subject: string(n)
, matched_beg: &int? >> int(n0)
, matched_end: &int? >> int(n1)
, err: &int? >> int
) : #[n0,n1:int | n0 <= n1; n1 <= n] List0_vt(Strptr0)
Description
Compared with regstr_match2_string, this function returns a
list of (linear) strings that are copies of the captured portions in the
given subject string. Note that the integer value stored in the
call-by-reference argument err indicates whether matching succeeded or
failed; if the value is negative, then matching failed; if the value is
zero, then matching succeeded and the length of the returned list equals a
fixed integer (currently chosen to be 15); otherwise, matching succeeded
and the length of the returned list equals the value minus 1.
Synopsis
fun{
} regstr_match3_substring
{n:int}{st,ln:int | st+ln <= n}
(
regstr: string
, subject: string(n)
, st: size_t st, ln: size_t ln
, matched_beg: &int? >> int(n0)
, matched_end: &int? >> int(n1)
, err: &int? >> int
) : #[n0,n1:int | n0 <= n1; n1 <= st+ln] List0_vt(Strptr0)
Description
This function is a slightly generalized variant of regstr_match3_string.