#if !defined(lptypes_h)
#define lptypes_h
#if !defined(LPEG_DEBUG)
#define NDEBUG
#endif
#include <assert.h>
#include <limits.h>
#include "lua.h"
#define VERSION "1.0.0"
#define PATTERN_T "lpeg-pattern"
#if (LUA_VERSION_NUM == 501)
#define lp_equal lua_equal
#define lua_getuservalue lua_getfenv
#define lua_setuservalue lua_setfenv
#define lua_rawlen lua_objlen
#define luaL_setfuncs(L,f,n) luaL_register(L,NULL,f)
#define luaL_newlib(L,f) luaL_register(L,"lpeg",f)
#endif
#if !defined(lp_equal)
#define lp_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ)
#endif
#define INITSTACK 200
#define MAXSTACKIDX USHRT_MAX
#if !defined(MAXRULES)
#define MAXRULES 1000
#endif
#define INITCAPSIZE 2000
#define SUBJIDX 2
#define FIXEDARGS 3
#define loopset(v,b) { int v; for (v = 0; v < CHARSETSIZE; v++) {b;} }
#define treebuffer(t) ((byte *)((t) + 1))
#define bytes2slots(n) (((n) - 1) / sizeof(TTree) + 1)
#define setchar(cs,b) ((cs)[(b) >> 3] |= (1 << ((b) & 7)))
#define MAXBEHIND 0x7FFF
#define MAXPATTSIZE (SHRT_MAX - 10)
#define instsize(l) (((l) + sizeof(Instruction) - 1)/sizeof(Instruction) + 1)
#define CHARSETINSTSIZE instsize(CHARSETSIZE)
#define funcinstsize(p) ((p)->i.aux + 2)
#define testchar(st,c) (((int)(st)[((c) >> 3)] & (1 << ((c) & 7))))
#endif