lpcode.h 675 B

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