summaryrefslogtreecommitdiffstats
path: root/regex.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2009-11-28 04:15:19 -0800
committerKaz Kylheku <kaz@kylheku.com>2009-11-28 04:15:19 -0800
commit788cace2cb783db0b4df6338f89e6b026ae23e9b (patch)
tree62ef4b70c7631651f90da8af58c78bfe7877f454 /regex.h
parentec1f42927b870770d77aa196bdf7adfff4475210 (diff)
downloadtxr-788cace2cb783db0b4df6338f89e6b026ae23e9b.tar.gz
txr-788cace2cb783db0b4df6338f89e6b026ae23e9b.tar.bz2
txr-788cace2cb783db0b4df6338f89e6b026ae23e9b.zip
Code cleanup. All private functions static. Private stuff
in regex module not exposed in header. Etc.
Diffstat (limited to 'regex.h')
-rw-r--r--regex.h116
1 files changed, 1 insertions, 115 deletions
diff --git a/regex.h b/regex.h
index 56e375c9..09bfa2d5 100644
--- a/regex.h
+++ b/regex.h
@@ -26,115 +26,8 @@
#include <limits.h>
-typedef unsigned int bitcell_t;
-
-#define BITCELL_ALL1 UINT_MAX
-#define CHAR_SET_SIZE (256 / (sizeof (bitcell_t) * CHAR_BIT))
-
-typedef enum {
- CHSET_SMALL, CHSET_DISPLACED, CHSET_LARGE, CHSET_XLARGE
-} chset_type_t;
-
-typedef bitcell_t cset_L0_t[CHAR_SET_SIZE];
-typedef cset_L0_t *cset_L1_t[16];
-typedef cset_L1_t *cset_L2_t[16];
-typedef cset_L2_t *cset_L3_t[17];
-
-struct any_char_set {
- unsigned type : 3;
- unsigned comp : 1;
-};
-
-struct small_char_set {
- unsigned type : 3;
- unsigned comp : 1;
- cset_L0_t bitcell;
-};
-
-struct displaced_char_set {
- unsigned type : 3;
- unsigned comp : 1;
- cset_L0_t bitcell;
- wchar_t base;
-};
-
-
-struct large_char_set {
- unsigned type : 3;
- unsigned comp : 1;
- cset_L2_t dir;
-};
-
-struct xlarge_char_set {
- unsigned type : 3;
- unsigned comp : 1;
- cset_L3_t dir;
-};
-
-typedef union char_set {
- struct any_char_set any;
- struct small_char_set s;
- struct displaced_char_set d;
- struct large_char_set l;
- struct xlarge_char_set xl;
-} char_set_t;
-
-char_set_t *char_set_create(chset_type_t, wchar_t);
-void char_set_destroy(char_set_t *);
-
-void char_set_compl(char_set_t *);
-void char_set_add(char_set_t *, wchar_t);
-void char_set_add_range(char_set_t *, wchar_t, wchar_t); /* inclusive */
-int char_set_contains(char_set_t *, wchar_t);
-
-typedef enum {
- nfa_accept, nfa_empty, nfa_wild, nfa_single, nfa_set
-} nfa_kind_t;
-
typedef union nfa_state nfa_state_t;
-struct nfa_state_accept {
- nfa_kind_t kind;
- unsigned visited;
-};
-
-struct nfa_state_empty {
- nfa_kind_t kind;
- unsigned visited;
- nfa_state_t *trans0;
- nfa_state_t *trans1;
-};
-
-struct nfa_state_single {
- nfa_kind_t kind;
- unsigned visited;
- nfa_state_t *trans;
- wchar_t ch;
-};
-
-struct nfa_state_set {
- nfa_kind_t kind;
- unsigned visited;
- nfa_state_t *trans;
- char_set_t *set;
-};
-
-union nfa_state {
- struct nfa_state_accept a;
- struct nfa_state_empty e;
- struct nfa_state_single o;
- struct nfa_state_set s;
-};
-
-nfa_state_t *nfa_state_accept(void);
-nfa_state_t *nfa_state_empty(nfa_state_t *, nfa_state_t *);
-nfa_state_t *nfa_state_single(nfa_state_t *, wchar_t ch);
-nfa_state_t *nfa_state_wild(nfa_state_t *);
-nfa_state_t *nfa_state_set(nfa_state_t *, char_set_t *);
-void nfa_state_free(nfa_state_t *st);
-void nfa_state_shallow_free(nfa_state_t *st);
-void nfa_state_merge(nfa_state_t *accept, nfa_state_t *);
-
typedef struct nfa {
nfa_state_t *start;
nfa_state_t *accept;
@@ -144,14 +37,7 @@ typedef enum nfam_result {
NFAM_INCOMPLETE, NFAM_FAIL, NFAM_MATCH
} nfam_result_t;
-typedef struct nfa_machine {
- cnum last_accept_pos;
- unsigned visited;
- nfa_state_t **move, **clos, **stack;
- int nmove, nclos;
- cnum count;
- nfa_t nfa;
-} nfa_machine_t;
+typedef struct nfa_machine nfa_machine_t;
nfa_t nfa_compile_regex(val regex);
void nfa_free(nfa_t);