view regexParser/regexParser.h @ 191:02031fb73af8 pairPro

remove somefiles and fix header files
author Masataka Kohagura <>
date Fri, 25 Dec 2015 16:08:02 +0900
parents 3e8e5780ad4a
children ecf70fb215a5
line wrap: on
line source

#define NEW(type) (type*)malloc(sizeof(type))


#define BITBLOCK 64
typedef struct bitVector {
    unsigned long bitContainer;
} BitVector,*BitVectorPtr;

typedef struct word {
    unsigned char *word;
    int length;
} Word, *WordPtr;

typedef struct utf8Range {
    unsigned long begin;
    unsigned long end;
    struct utf8Range *next; // only used in the parser.
} RangeList , *RangeListPtr;

typedef struct condition {
    RangeList range;
    Word w;
} Condition, *ConditionList;

typedef struct charClass {
    unsigned char type;
    struct charClass *left;
    struct charClass *right;
    Condition cond;
    BitVector nextState;
} CharClass, *CharClassPtr;

struct node;

typedef struct state {
    BitVector bitState;
    CharClassPtr cc;
    struct node *node;
    struct state *next;
} State, *StatePtr;

typedef struct node {
    unsigned char tokenType;
    CharClassPtr cc;
    int stateNum;
    int nextStateNum;
    StatePtr state;
    struct node *left;
    struct node *right;
} Node, *NodePtr;

typedef struct stateStack {
    BitVector state;
    struct stateStack *next;
} StateStack, *StateStackPtr;

typedef struct transitionGenerator {
    long stateMax;
    StateStackPtr stack;
    StatePtr state;
    StatePtr stateArray;
    StatePtr currentState;
    StatePtr startState;
    StatePtr endState;
} TransitionGenerator, *TransitionGeneratorPtr;

typedef struct tgValue {
    bool asterisk;
    int stateNum;
    int stateBegin;
    int stateEnd;
    StatePtr tgState;
    TransitionGeneratorPtr tg;
} TGValue, *TGValuePtr;

enum charClassStackState {

typedef struct charClassStack {
    charClassStackState turn;
    CharClassPtr cc;
    struct charClassStack *next;
} CharClassStack, *CharClassStackPtr;

typedef struct charClassWalker {
    CharClassStackPtr stack;
    CharClassPtr next;
} CharClassWalker, *CharClassWalkerPtr;

typedef struct regexInfo {
    unsigned char *ptr;
    unsigned char tokenType;
    unsigned char *tokenValue;
    int stateNumber;
} RegexInfo, *RegexInfoPtr;

extern NodePtr createNode(RegexInfoPtr ri,unsigned char type,CharClassPtr cc, NodePtr left, NodePtr right);
extern CharClassPtr createCharClassRange(unsigned long begin, unsigned long end,unsigned long state, CharClassPtr left, CharClassPtr right);
extern NodePtr regex(RegexInfoPtr);