robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

robinmerge: 9a29622b3b00ddb601

master
675 B36 linesraw
1
2#if !defined(lpcode_h)
3#define lpcode_h
4
5#include "lua.h"
6
7#include "lptypes.h"
8#include "lptree.h"
9#include "lpvm.h"
10
11int checkaux (TTree *tree, int pred);
12int fixedlen (TTree *tree);
13int hascaptures (TTree *tree);
14int lp_gc (lua_State *L);
15Instruction *compile (lua_State *L, Pattern *p, uint size);
16void freecode (lua_State *L, Pattern *p);
17int sizei (const Instruction *i);
18
19
20#define PEnullable      0
21#define PEnofail        1
22
23/*
24** nofail(t) implies that 't' cannot fail with any input
25*/
26#define nofail(t)	checkaux(t, PEnofail)
27
28/*
29** (not nullable(t)) implies 't' cannot match without consuming
30** something
31*/
32#define nullable(t)	checkaux(t, PEnullable)
33
34
35
36#endif