diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-07 13:52:41 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-12-07 13:52:41 +0000 |
commit | ee98688103cf7bb7e14a4356adf055c77201b9f2 (patch) | |
tree | d49c7120fcc79201051770f53ae7885195ae00ca /contrib/lpeg/lpcode.h | |
parent | dbb7d466b83fa063d2b98aaf533bce74b19535e5 (diff) | |
download | rspamd-ee98688103cf7bb7e14a4356adf055c77201b9f2.tar.gz rspamd-ee98688103cf7bb7e14a4356adf055c77201b9f2.zip |
Add LPeg support to rspamd
Diffstat (limited to 'contrib/lpeg/lpcode.h')
-rw-r--r-- | contrib/lpeg/lpcode.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/contrib/lpeg/lpcode.h b/contrib/lpeg/lpcode.h new file mode 100644 index 000000000..896d3c79a --- /dev/null +++ b/contrib/lpeg/lpcode.h @@ -0,0 +1,42 @@ +/* +** $Id: lpcode.h,v 1.7 2015/06/12 18:24:45 roberto Exp $ +*/ + +#if !defined(lpcode_h) +#define lpcode_h + +#include "lua.h" + +#include "lptypes.h" +#include "lptree.h" +#include "lpvm.h" + +int tocharset (TTree *tree, Charset *cs); +int checkaux (TTree *tree, int pred); +int fixedlenx (TTree *tree, int count, int len); +int hascaptures (TTree *tree); +int lp_gc (lua_State *L); +Instruction *compile (lua_State *L, Pattern *p); +void realloccode (lua_State *L, Pattern *p, int nsize); +int sizei (const Instruction *i); + + +#define PEnullable 0 +#define PEnofail 1 + +/* +** nofail(t) implies that 't' cannot fail with any input +*/ +#define nofail(t) checkaux(t, PEnofail) + +/* +** (not nullable(t)) implies 't' cannot match without consuming +** something +*/ +#define nullable(t) checkaux(t, PEnullable) + +#define fixedlen(t) fixedlenx(t, 0, 0) + + + +#endif |