You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lpcap.h 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. ** $Id: lpcap.h,v 1.2 2015/02/27 17:13:17 roberto Exp $
  3. */
  4. #if !defined(lpcap_h)
  5. #define lpcap_h
  6. #include "lptypes.h"
  7. /* kinds of captures */
  8. typedef enum CapKind {
  9. Cclose, Cposition, Cconst, Cbackref, Carg, Csimple, Ctable, Cfunction,
  10. Cquery, Cstring, Cnum, Csubst, Cfold, Cruntime, Cgroup
  11. } CapKind;
  12. typedef struct Capture {
  13. const char *s; /* subject position */
  14. unsigned short idx; /* extra info (group name, arg index, etc.) */
  15. byte kind; /* kind of capture */
  16. byte siz; /* size of full capture + 1 (0 = not a full capture) */
  17. } Capture;
  18. typedef struct CapState {
  19. Capture *cap; /* current capture */
  20. Capture *ocap; /* (original) capture list */
  21. lua_State *L;
  22. int ptop; /* index of last argument to 'match' */
  23. const char *s; /* original string */
  24. int valuecached; /* value stored in cache slot */
  25. } CapState;
  26. int runtimecap (CapState *cs, Capture *close, const char *s, int *rem);
  27. int getcaptures (lua_State *L, const char *s, const char *r, int ptop);
  28. int finddyncap (Capture *cap, Capture *last);
  29. #endif