blob: 7f7b37cff9334fc1713e12afb37478c24addb159 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
type
LREFlag* {.size: sizeof(cint).} = enum
LRE_FLAG_GLOBAL = "g"
LRE_FLAG_IGNORECASE = "i"
LRE_FLAG_MULTILINE = "m"
LRE_FLAG_DOTALL = "s"
LRE_FLAG_UNICODE = "u"
LRE_FLAG_STICKY = "y"
LREFlags* = set[LREFlag]
func toCInt*(flags: LREFlags): cint =
cint(cast[uint8](flags))
func toLREFlags*(flags: cint): LREFlags =
cast[LREFlags](flags)
{.passc: "-Ilib/".}
{.push header: "quickjs/libregexp.h", importc.}
proc lre_compile*(plen: ptr cint, error_msg: cstring, error_msg_size: cint,
buf: cstring, buf_len: csize_t, re_flags: cint, opaque: pointer): ptr uint8
proc lre_exec*(capture: ptr ptr uint8, bc_buf: ptr uint8, cbuf: ptr uint8,
cindex: cint, clen: cint, cbuf_type: cint, opaque: pointer): cint
proc lre_get_capture_count*(bc_buf: ptr uint8): cint
proc lre_get_flags*(bc_buf: ptr uint8): cint
{.pop.}
|