CWB
|
#include "cqp.h"
The DFA object.
A Deterministic Finite Automaton: into which a regular expression can be converted.
(Note this is regular expression across tokens, not single-string regexes, which are dealt with by functions in the corpus library.)
TODO: rename the functions and make this more object-oriented. Ideally, this should be a cleanly separated module, with "in" and "out" only via the methods declared here. Currently it's not like that - info is passed in via global variables, most blatantly searchstr.
void free_dfa | ( | DFA * | dfa | ) |
Frees all the memory associated with this DFA.
References dfa::Final, dfa::Max_Input, dfa::Max_States, and dfa::TransTable.
Referenced by free_environment().
void init_dfa | ( | DFA * | dfa | ) |
Initialises the members of the given DFA object.
References dfa::Final, dfa::Max_Input, dfa::Max_States, and dfa::TransTable.
Referenced by next_environment().
void regex2dfa | ( | char * | rxs, |
DFA * | automaton | ||
) |
Converts a regular expression to a DFA.
Public function.
rxs | The regular expression. |
automaton | Pointer to the DFA object to write to. |
References C, cl_malloc(), 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, SP, Ss, dfa::TransTable, True, and WriteStates().
Referenced by do_SearchPattern().
void show_complete_dfa | ( | DFA | dfa | ) |
Prints the contents of a DFA to NULL.
References dfa::E_State, dfa::Final, dfa::Max_Input, dfa::Max_States, and dfa::TransTable.
Referenced by show_environment().