#include "regexp.h"
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
Defines | |
#define | END 0 |
#define | BOL 1 |
#define | EOL 2 |
#define | ANY 3 |
#define | ANYOF 4 |
#define | ANYBUT 5 |
#define | BRANCH 6 |
#define | BACK 7 |
#define | EXACTLY 8 |
#define | NOTHING 9 |
#define | STAR 10 |
#define | PLUS 11 |
#define | WORDA 12 |
#define | WORDZ 13 |
#define | OPEN 20 |
#define | CLOSE 30 |
#define | OP(p) (*(p)) |
#define | NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&0377)) |
#define | OPERAND(p) ((p) + 3) |
#define | UCHARAT(p) ((int)*(unsigned char *)(p)) |
#define | FAIL(m) { regerror(m); return(NULL); } |
#define | ISMULT(c) ((c) == '*' || (c) == '+' || (c) == '?') |
#define | HASWIDTH 01 |
#define | SIMPLE 02 |
#define | SPSTART 04 |
#define | WORST 0 |
#define | STATIC static |
Functions | |
STATIC char * | reg (int paren, int *flagp) |
STATIC char * | regbranch (int *flagp) |
STATIC char * | regpiece (int *flagp) |
STATIC char * | regatom (int *flagp) |
STATIC char * | regnode (int op) |
STATIC char * | regnext (register char *p) |
STATIC void | regc (int b) |
STATIC void | reginsert (char op, char *opnd) |
STATIC void | regtail (char *p, char *val) |
STATIC void | regoptail (char *p, char *val) |
regexp * | regcomp (const char *exp) |
STATIC int | regtry (regexp *prog, const char *string) |
STATIC int | regmatch (char *prog) |
STATIC int | regrepeat (char *p) |
int | regexec (register regexp *prog, register const char *string) |
void | regerror (const char *s) |
Variables | |
static char * | regparse |
static int | regnpar |
static char | regdummy |
static char * | regcode |
static long | regsize |
static const char * | reginput |
static char * | regbol |
static const char ** | regstartp |
static const char ** | regendp |
#define ANY 3 |
#define ANYBUT 5 |
#define ANYOF 4 |
#define BACK 7 |
#define BOL 1 |
#define BRANCH 6 |
#define CLOSE 30 |
#define END 0 |
#define EOL 2 |
#define EXACTLY 8 |
#define FAIL | ( | m | ) | { regerror(m); return(NULL); } |
#define HASWIDTH 01 |
#define ISMULT | ( | c | ) | ((c) == '*' || (c) == '+' || (c) == '?') |
#define NEXT | ( | p | ) | (((*((p)+1)&0377)<<8) + (*((p)+2)&0377)) |
#define NOTHING 9 |
#define OP | ( | p | ) | (*(p)) |
#define OPEN 20 |
#define OPERAND | ( | p | ) | ((p) + 3) |
#define PLUS 11 |
#define SIMPLE 02 |
#define SPSTART 04 |
#define STAR 10 |
#define STATIC static |
#define UCHARAT | ( | p | ) | ((int)*(unsigned char *)(p)) |
#define WORDA 12 |
#define WORDZ 13 |
#define WORST 0 |
static char * reg | ( | int | paren, | |
int * | flagp | |||
) |
static char * regatom | ( | int * | flagp | ) |
static char * regbranch | ( | int * | flagp | ) |
static void regc | ( | int | b | ) |
regexp* regcomp | ( | const char * | exp | ) |
void regerror | ( | const char * | s | ) |
int regexec | ( | register regexp * | prog, | |
register const char * | string | |||
) |
static void reginsert | ( | char | op, | |
char * | opnd | |||
) |
static int regmatch | ( | char * | prog | ) |
static char * regnext | ( | register char * | p | ) |
static char * regnode | ( | int | op | ) |
static void regoptail | ( | char * | p, | |
char * | val | |||
) |
static char * regpiece | ( | int * | flagp | ) |
static int regrepeat | ( | char * | p | ) |
static void regtail | ( | char * | p, | |
char * | val | |||
) |
static int regtry | ( | regexp * | prog, | |
const char * | string | |||
) |
char* regbol [static] |
char* regcode [static] |
char regdummy [static] |
const char** regendp [static] |
const char* reginput [static] |
int regnpar [static] |
char* regparse [static] |
long regsize [static] |
const char** regstartp [static] |