From ee98688103cf7bb7e14a4356adf055c77201b9f2 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 7 Dec 2015 13:52:41 +0000 Subject: Add LPeg support to rspamd --- contrib/lpeg/lpcode.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 contrib/lpeg/lpcode.h (limited to 'contrib/lpeg/lpcode.h') 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 -- cgit v1.2.3