Blame lpvm.h

Packit 909456
/*
Packit 909456
** $Id: lpvm.h,v 1.3 2014/02/21 13:06:41 roberto Exp $
Packit 909456
*/
Packit 909456
Packit 909456
#if !defined(lpvm_h)
Packit 909456
#define lpvm_h
Packit 909456
Packit 909456
#include "lpcap.h"
Packit 909456
Packit 909456
Packit 909456
/* Virtual Machine's instructions */
Packit 909456
typedef enum Opcode {
Packit 909456
  IAny, /* if no char, fail */
Packit 909456
  IChar,  /* if char != aux, fail */
Packit 909456
  ISet,  /* if char not in buff, fail */
Packit 909456
  ITestAny,  /* in no char, jump to 'offset' */
Packit 909456
  ITestChar,  /* if char != aux, jump to 'offset' */
Packit 909456
  ITestSet,  /* if char not in buff, jump to 'offset' */
Packit 909456
  ISpan,  /* read a span of chars in buff */
Packit 909456
  IBehind,  /* walk back 'aux' characters (fail if not possible) */
Packit 909456
  IRet,  /* return from a rule */
Packit 909456
  IEnd,  /* end of pattern */
Packit 909456
  IChoice,  /* stack a choice; next fail will jump to 'offset' */
Packit 909456
  IJmp,  /* jump to 'offset' */
Packit 909456
  ICall,  /* call rule at 'offset' */
Packit 909456
  IOpenCall,  /* call rule number 'key' (must be closed to a ICall) */
Packit 909456
  ICommit,  /* pop choice and jump to 'offset' */
Packit 909456
  IPartialCommit,  /* update top choice to current position and jump */
Packit 909456
  IBackCommit,  /* "fails" but jump to its own 'offset' */
Packit 909456
  IFailTwice,  /* pop one choice and then fail */
Packit 909456
  IFail,  /* go back to saved state on choice and jump to saved offset */
Packit 909456
  IGiveup,  /* internal use */
Packit 909456
  IFullCapture,  /* complete capture of last 'off' chars */
Packit 909456
  IOpenCapture,  /* start a capture */
Packit 909456
  ICloseCapture,
Packit 909456
  ICloseRunTime
Packit 909456
} Opcode;
Packit 909456
Packit 909456
Packit 909456
Packit 909456
typedef union Instruction {
Packit 909456
  struct Inst {
Packit 909456
    byte code;
Packit 909456
    byte aux;
Packit 909456
    short key;
Packit 909456
  } i;
Packit 909456
  int offset;
Packit 909456
  byte buff[1];
Packit 909456
} Instruction;
Packit 909456
Packit 909456
Packit 909456
void printpatt (Instruction *p, int n);
Packit 909456
const char *match (lua_State *L, const char *o, const char *s, const char *e,
Packit 909456
                   Instruction *op, Capture *capture, int ptop);
Packit 909456
Packit 909456
Packit 909456
#endif
Packit 909456