#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"
#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 STACK_MAX 200 |
Referenced by PUSH().
#define X_EXTEND 4 |
Referenced by PushQ().
typedef unsigned char byte |
enum ExpTag |
enum Lexical |
enum StackTag |
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().
static void ERROR | ( | char * | Format, | |
... | ||||
) | [static] |
void FormState | ( | int | Q | ) |
References AddBuf(), AddState(), Allocate(), AndX, exp::Arg, exp::Body, state::Empty, IMax, Is, exp::Leaf, item::LHS, state::LHS, MakeExp(), OneX, OptX, OrX, PlusX, PopQ(), PushQ(), state::RHS, state::Shifts, state::ShList, state::SList, Ss, StarX, state::States, SymX, exp::Tag, equation::Value, Xs, XStack, and ZeroX.
Referenced by regex2dfa().
void free_dfa | ( | DFA * | dfa | ) |
References dfa::Final, dfa::Max_Input, dfa::Max_States, and dfa::TransTable.
Referenced by free_environment().
byte Hash | ( | char * | S | ) |
void init | ( | void | ) |
void init_dfa | ( | DFA * | dfa | ) |
References dfa::Final, dfa::Max_Input, dfa::Max_States, and dfa::TransTable.
Referenced by next_environment().
Lexical LEX | ( | void | ) |
Symbol LookUp | ( | char * | S | ) |
References Allocate(), CopyS(), symbol::Hash, Hash, symbol::Name, symbol::Next, and symbol::Tail.
Referenced by Parse().
int MakeExp | ( | int | Q, | |
ExpTag | Tag, | |||
... | ||||
) |
References Allocate(), AndX, exp::Arg, exp::Body, exp::Class, DUP(), EQU_EXTEND, EquMax, Equs, exp::Hash, Hash, equation::Hash, symbol::Hash, exp::Leaf, OneX, OptX, OrX, PlusX, Reallocate(), equation::Stack, StarX, SymX, exp::Tag, exp::Tail, equation::Value, and ZeroX.
Referenced by FormState(), and Parse().
void MergeStates | ( | void | ) |
References AddEquiv(), state::Class, EMax, state::Empty, Es, ETab, Equiv::L, state::LHS, Equiv::R, state::RHS, state::Shifts, state::ShList, and Ss.
Referenced by regex2dfa().
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.
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 | ) |
References dfa::E_State, dfa::Final, dfa::Max_Input, dfa::Max_States, and dfa::TransTable.
Referenced by show_environment().
void Store | ( | Symbol | S, | |
int | Q | |||
) |
References Allocate(), exp::Body, exp::Class, exp::Hash, symbol::Hash, exp::Leaf, SymX, exp::Tag, and exp::Tail.
Referenced by Parse().
void WriteStates | ( | void | ) |
References C, state::Class, state::Empty, state::LHS, symbol::Name, state::RHS, state::Shifts, state::ShList, and Ss.
Referenced by regex2dfa().
char* Action[7] |
{ ".ABCH|&&&&&+*", "I=BCH|&&&&&+*", "DD)FH|&&&&&+*", "EEG]H|&&&&&+*", "vvvvv|&&&&&+*", "xxxxxx&&&&&+*" }
Referenced by Parse().
int EMax |
Referenced by AddEquiv(), and MergeStates().
int ERRORS |
Referenced by ERROR(), init(), and regex2dfa().
int Es |
Referenced by AddEquiv(), and MergeStates().
Referenced by AddEquiv(), init(), and MergeStates().
int IMax |
Referenced by AddBuf(), and FormState().
int Is |
Referenced by AddBuf(), and FormState().
char* searchstr |
int Ss |
Referenced by AddState(), FormState(), init(), MergeStates(), regex2dfa(), and WriteStates().
int Xs |
Referenced by FormState(), init(), PopQ(), and PushQ().
int* XStack = NULL |
Referenced by FormState(), init(), PopQ(), and PushQ().