Sha256: cfffde734cd9030cb2622474fd5f74d6a8fcf91f8ee0b80e45a53156c55f5691

Contents?: true

Size: 1.54 KB

Versions: 33

Compression:

Stored size: 1.54 KB

Contents

/*  
** $Id: lptree.h,v 1.2 2013/03/24 13:51:12 roberto Exp $
*/

#if !defined(lptree_h)
#define lptree_h


#include "lptypes.h" 


/*
** types of trees
*/
typedef enum TTag {
  TChar = 0, TSet, TAny,  /* standard PEG elements */
  TTrue, TFalse,
  TRep,
  TSeq, TChoice,
  TNot, TAnd,
  TCall,
  TOpenCall,
  TRule,  /* sib1 is rule's pattern, sib2 is 'next' rule */
  TGrammar,  /* sib1 is initial (and first) rule */
  TBehind,  /* match behind */
  TCapture,  /* regular capture */
  TRunTime  /* run-time capture */
} TTag;

/* number of siblings for each tree */
extern const byte numsiblings[];


/*
** Tree trees
** The first sibling of a tree (if there is one) is immediately after
** the tree.  A reference to a second sibling (ps) is its position
** relative to the position of the tree itself.  A key in ktable
** uses the (unique) address of the original tree that created that
** entry. NULL means no data.
*/
typedef struct TTree {
  byte tag;
  byte cap;  /* kind of capture (if it is a capture) */
  unsigned short key;  /* key in ktable for Lua data (0 if no key) */
  union {
    int ps;  /* occasional second sibling */
    int n;  /* occasional counter */
  } u;
} TTree;


/*
** A complete pattern has its tree plus, if already compiled,
** its corresponding code
*/
typedef struct Pattern {
  union LpegInstruction *code;
  int codesize;
  TTree tree[1];
} Pattern;


/* number of siblings for each tree */
extern const byte numsiblings[];

/* access to siblings */
#define sib1(t)         ((t) + 1)
#define sib2(t)         ((t) + (t)->u.ps)






#endif

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
immunio-1.1.13 lua-hooks/ext/lpeg/lptree.h
immunio-1.1.11 lua-hooks/ext/lpeg/lptree.h
immunio-1.1.10 lua-hooks/ext/lpeg/lptree.h
immunio-1.1.7 lua-hooks/ext/lpeg/lptree.h
immunio-1.1.6 lua-hooks/ext/lpeg/lptree.h
immunio-1.1.5 lua-hooks/ext/lpeg/lptree.h
immunio-1.1.2 lua-hooks/ext/lpeg/lptree.h
immunio-1.1.1 lua-hooks/ext/lpeg/lptree.h
immunio-1.1.0 lua-hooks/ext/lpeg/lptree.h
immunio-1.0.22 lua-hooks/ext/lpeg/lptree.h
immunio-1.0.19 lua-hooks/ext/lpeg/lptree.h
immunio-1.0.17 lua-hooks/ext/lpeg/lptree.h
immunio-1.0.15 lua-hooks/ext/lpeg/lptree.h
immunio-1.0.14 lua-hooks/ext/lpeg/lptree.h
immunio-1.0.13 lua-hooks/ext/lpeg/lptree.h
immunio-1.0.12 lua-hooks/ext/lpeg/lptree.h
immunio-1.0.11 lua-hooks/ext/lpeg/lptree.h
immunio-1.0.10 lua-hooks/ext/lpeg/lptree.h
immunio-1.0.9 lua-hooks/ext/lpeg/lptree.h
immunio-1.0.8 lua-hooks/ext/lpeg/lptree.h