From 6a7e7f8bc9182675098b587ff22b629654bd473d Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Tue, 7 Jan 2014 15:01:45 +0200 Subject: enable defining flags when compiling regexp --- trex.c | 4 +++- trex.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/trex.c b/trex.c index b66727f..d597265 100644 --- a/trex.c +++ b/trex.c @@ -76,6 +76,7 @@ struct TRex{ int _currsubexp; void *_jmpbuf; const TRexChar **_error; + int _flags; }; static int trex_list(TRex *exp); @@ -528,7 +529,7 @@ static const TRexChar *trex_matchnode(TRex* exp,TRexNode *node,const TRexChar *s } /* public api */ -TRex *trex_compile(const TRexChar *pattern,const TRexChar **error) +TRex *trex_compile(const TRexChar *pattern,const TRexChar **error,int flags) { TRex *exp = (TRex *)malloc(sizeof(TRex)); exp->_eol = exp->_bol = NULL; @@ -541,6 +542,7 @@ TRex *trex_compile(const TRexChar *pattern,const TRexChar **error) exp->_first = trex_newnode(exp,OP_EXPR); exp->_error = error; exp->_jmpbuf = malloc(sizeof(jmp_buf)); + exp->_flags = flags; if(setjmp(*((jmp_buf*)exp->_jmpbuf)) == 0) { int res = trex_list(exp); exp->_nodes[exp->_first].left = res; diff --git a/trex.h b/trex.h index 2ba378f..698147d 100644 --- a/trex.h +++ b/trex.h @@ -56,7 +56,7 @@ typedef struct { int len; } TRexMatch; -TREX_API TRex *trex_compile(const TRexChar *pattern,const TRexChar **error); +TREX_API TRex *trex_compile(const TRexChar *pattern,const TRexChar **error,int flags); TREX_API void trex_free(TRex *exp); TREX_API TRexBool trex_match(TRex* exp,const TRexChar* text); TREX_API TRexBool trex_search(TRex* exp,const TRexChar* text, const TRexChar** out_begin, const TRexChar** out_end); -- cgit v1.2.3