regex2dfa.c File Reference

#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <assert.h>
#include "../cl/macros.h"
#include "eval.h"
#include "options.h"
#include "regex2dfa.h"

Data Structures

Defines

Typedefs

Enumerations

Functions

Variables


Define Documentation

#define EQU_EXTEND   0x200

Referenced by MakeExp().

#define HASH_MAX   0x200

Referenced by init().

#define MAX_CHAR   0x4000

Referenced by LEX().

#define MAX_ERRORS   25

Referenced by ERROR().

#define NN   0x200

Referenced by DUP(), and init().

 
#define POP (  )     ((--SP)->Q)

Referenced by Parse().

#define STACK_MAX   200

Referenced by PUSH().

#define TOP   ((SP - 1)->Tag)

Referenced by Parse().

#define X_EXTEND   4

Referenced by PushQ().


Typedef Documentation

typedef unsigned char byte
typedef struct equation* Equation
typedef struct exp* Exp
typedef struct item * Item
typedef struct state * State
typedef struct symbol* Symbol

Enumeration Type Documentation

enum ExpTag
Enumerator:
SymX 
ZeroX 
OneX 
AndX 
OrX 
StarX 
PlusX 
OptX 
enum Lexical
Enumerator:
EndT 
CommaT 
RParT 
RBrT 
EqualT 
BarT 
ZeroT 
OneT 
IdenT 
LParT 
LBrT 
PlusT 
StarT 
enum StackTag
Enumerator:
RULE 
EQU 
PAR 
OPT 
OR 
AND 

Function Documentation

void AddBuf ( Symbol  LHS,
int  Q 
)

References IMax, Is, item::LHS, symbol::Name, Reallocate(), item::RHS, and item::Size.

Referenced by FormState().

void AddEquiv ( int  L,
int  R 
)

References state::Class, EMax, Es, ETab, Equiv::L, Equiv::R, and Reallocate().

Referenced by MergeStates().

int AddState ( int  States,
int *  SList 
)

References state::Class, Reallocate(), state::SList, Ss, and state::States.

Referenced by FormState().

void* Allocate ( unsigned  Bytes  ) 

References cl_malloc().

Referenced by CopyS(), FormState(), LookUp(), MakeExp(), regex2dfa(), and Store().

char* CopyS ( char *  S  ) 

References Allocate().

Referenced by LookUp().

int DUP ( int  A,
int  B 
)

References NN.

Referenced by MakeExp().

static void ERROR ( char *  Format,
  ... 
) [static]

References ERRORS, LINE, and MAX_ERRORS.

Referenced by LEX(), Parse(), and PUSH().

void FormState ( int  Q  ) 
void free_dfa ( DFA dfa  ) 
static int GET ( void   )  [static]

References currpos, and searchstr.

Referenced by LEX().

byte Hash ( char *  S  ) 
void init ( void   ) 

References ChArr, ChP, currpos, EquMax, Equs, ERRORS, ETab, HASH_MAX, LINE, NN, Ss, XMax, Xs, and XStack.

Referenced by regex2dfa().

void init_dfa ( DFA dfa  ) 
Lexical LEX ( void   ) 
Symbol LookUp ( char *  S  ) 
int MakeExp ( int  Q,
ExpTag  Tag,
  ... 
)
void MergeStates ( void   ) 
int Parse ( void   ) 
void PopQ ( void   ) 

References equation::Stack, Xs, and XStack.

Referenced by FormState().

void PUSH ( StackTag  Tag,
int  Q 
)

References ERROR(), StackCard::Q, STACK_MAX, and StackCard::Tag.

Referenced by Parse().

void PushQ ( int  Q  ) 

References Reallocate(), equation::Stack, X_EXTEND, XMax, Xs, and XStack.

Referenced by FormState().

void* Reallocate ( void *  X,
unsigned  Bytes 
)

References cl_realloc().

Referenced by AddBuf(), AddEquiv(), AddState(), MakeExp(), and PushQ().

void regex2dfa ( char *  rxs,
DFA automaton 
)

Converts a regular expression to a DFA.

Parameters:
rxs The regular expression.
automaton Pointer to the DFA to write to.

References Allocate(), C, state::Class, dfa::E_State, eep, state::Empty, Environment, ERRORS, False, dfa::Final, FormState(), init(), state::LHS, dfa::Max_Input, dfa::Max_States, evalenv::MaxPatIndex, MergeStates(), symbol::Name, Parse(), state::RHS, searchstr, state::Shifts, state::ShList, show_dfa, Ss, dfa::TransTable, True, and WriteStates().

Referenced by do_SearchPattern().

void show_complete_dfa ( DFA  dfa  ) 
void Store ( Symbol  S,
int  Q 
)
static void UNGET ( int  Ch  )  [static]

References currpos.

Referenced by LEX().

void WriteStates ( void   ) 

Variable Documentation

char* Action[7]
Initial value:
 
{
  
  ".ABCH|&&&&&+*", 
  "I=BCH|&&&&&+*", 
  "DD)FH|&&&&&+*", 
  "EEG]H|&&&&&+*", 
  "vvvvv|&&&&&+*", 
  "xxxxxx&&&&&+*"  
}

Referenced by Parse().

char ChArr[MAX_CHAR] [static]

Referenced by init(), and LEX().

char* ChP

Referenced by init(), and LEX().

int currpos

Referenced by GET(), init(), and UNGET().

int EMax

Referenced by AddEquiv(), and MergeStates().

int EquMax

Referenced by init(), and MakeExp().

int Equs

Referenced by init(), and MakeExp().

int ERRORS

Referenced by ERROR(), init(), and regex2dfa().

int Es

Referenced by AddEquiv(), and MergeStates().

struct Equiv * ETab

Referenced by AddEquiv(), init(), and MergeStates().

Exp ExpHash[NN]
Symbol HashTab[HASH_MAX]
Item IBuf = (Item)NULL
int IMax

Referenced by AddBuf(), and FormState().

int Is

Referenced by AddBuf(), and FormState().

char* LastW

Referenced by LEX(), and Parse().

int LINE

Referenced by ERROR(), and init().

char* searchstr
int Ss
State STab = (State)NULL
StackCard Stack[STACK_MAX]
int XMax

Referenced by init(), and PushQ().

int Xs

Referenced by FormState(), init(), PopQ(), and PushQ().

int* XStack = NULL

Referenced by FormState(), init(), PopQ(), and PushQ().


Generated on Sun Feb 28 18:08:04 2010 for CWB by  doxygen 1.6.1