Edinburgh Speech Tools  2.1-release
regexp.cc File Reference
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include "regexp.h"
#include "regmagic.h"
Include dependency graph for regexp.cc:

Go to the source code of this file.

Macros

#define END   0 /* no End of program. */
 
#define BOL   1 /* no Match "" at beginning of line. */
 
#define EOL   2 /* no Match "" at end of line. */
 
#define ANY   3 /* no Match any one character. */
 
#define ANYOF   4 /* str Match any character in this string. */
 
#define ANYBUT   5 /* str Match any character not in this string. */
 
#define BRANCH   6 /* node Match this alternative, or the next... */
 
#define BACK   7 /* no Match "", "next" ptr points backward. */
 
#define EXACTLY   8 /* str Match this string. */
 
#define NOTHING   9 /* no Match empty string. */
 
#define STAR   10 /* node Match this (simple) thing 0 or more times. */
 
#define PLUS   11 /* node Match this (simple) thing 1 or more times. */
 
#define WORDA   12 /* no Match "" at wordchar, where prev is nonword */
 
#define WORDZ   13 /* no Match "" at nonwordchar, where prev is word */
 
#define OPEN   20 /* no Mark this point in input as start of #n. */
 
#define CLOSE   30 /* no Analogous to OPEN. */
 
#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)   { hs_regerror(m); return(NULL); }
 
#define ISMULT(c)   ((c) == '*' || (c) == '+' || (c) == '?')
 
#define HASWIDTH   01 /* Known never to match null string. */
 
#define SIMPLE   02 /* Simple enough to be STAR/PLUS operand. */
 
#define SPSTART   04 /* Starts with * or +. */
 
#define WORST   0 /* Worst case. */
 
#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 (char op)
 
STATIC char * regnext (register char *p)
 
STATIC void regc (unsigned char b)
 
STATIC void reginsert (char op, char *opnd)
 
STATIC void regtail (char *p, char *val)
 
STATIC void regoptail (char *p, char *val)
 
hs_regexphs_regcomp (const char *exp)
 
STATIC int regtry (hs_regexp *prog, const char *string)
 
STATIC int regmatch (char *prog)
 
STATIC int regrepeat (char *p)
 
int hs_regexec (const hs_regexp *prog, const char *string)
 

Macro Definition Documentation

#define END   0 /* no End of program. */

Definition at line 79 of file regexp.cc.

#define BOL   1 /* no Match "" at beginning of line. */

Definition at line 80 of file regexp.cc.

#define EOL   2 /* no Match "" at end of line. */

Definition at line 81 of file regexp.cc.

#define ANY   3 /* no Match any one character. */

Definition at line 82 of file regexp.cc.

#define ANYOF   4 /* str Match any character in this string. */

Definition at line 83 of file regexp.cc.

#define ANYBUT   5 /* str Match any character not in this string. */

Definition at line 84 of file regexp.cc.

#define BRANCH   6 /* node Match this alternative, or the next... */

Definition at line 85 of file regexp.cc.

#define BACK   7 /* no Match "", "next" ptr points backward. */

Definition at line 86 of file regexp.cc.

#define EXACTLY   8 /* str Match this string. */

Definition at line 87 of file regexp.cc.

#define NOTHING   9 /* no Match empty string. */

Definition at line 88 of file regexp.cc.

#define STAR   10 /* node Match this (simple) thing 0 or more times. */

Definition at line 89 of file regexp.cc.

#define PLUS   11 /* node Match this (simple) thing 1 or more times. */

Definition at line 90 of file regexp.cc.

#define WORDA   12 /* no Match "" at wordchar, where prev is nonword */

Definition at line 91 of file regexp.cc.

#define WORDZ   13 /* no Match "" at nonwordchar, where prev is word */

Definition at line 92 of file regexp.cc.

#define OPEN   20 /* no Mark this point in input as start of #n. */

Definition at line 93 of file regexp.cc.

#define CLOSE   30 /* no Analogous to OPEN. */

Definition at line 95 of file regexp.cc.

#define OP (   p)    (*(p))

Definition at line 129 of file regexp.cc.

#define NEXT (   p)    (((*((p)+1)&0377)<<8) + (*((p)+2)&0377))

Definition at line 130 of file regexp.cc.

#define OPERAND (   p)    ((p) + 3)

Definition at line 131 of file regexp.cc.

#define UCHARAT (   p)    ((int)*(unsigned char *)(p))

Definition at line 142 of file regexp.cc.

#define FAIL (   m)    { hs_regerror(m); return(NULL); }

Definition at line 147 of file regexp.cc.

#define ISMULT (   c)    ((c) == '*' || (c) == '+' || (c) == '?')

Definition at line 148 of file regexp.cc.

#define HASWIDTH   01 /* Known never to match null string. */

Definition at line 153 of file regexp.cc.

#define SIMPLE   02 /* Simple enough to be STAR/PLUS operand. */

Definition at line 154 of file regexp.cc.

#define SPSTART   04 /* Starts with * or +. */

Definition at line 155 of file regexp.cc.

#define WORST   0 /* Worst case. */

Definition at line 156 of file regexp.cc.

#define STATIC   static

Definition at line 171 of file regexp.cc.

Function Documentation

static char * reg ( int  paren,
int flagp 
)

Definition at line 293 of file regexp.cc.

static char * regbranch ( int flagp)

Definition at line 365 of file regexp.cc.

static char * regpiece ( int flagp)

Definition at line 404 of file regexp.cc.

static char * regatom ( int flagp)

Definition at line 467 of file regexp.cc.

static char * regnode ( char  op)

Definition at line 644 of file regexp.cc.

STATIC char* regnext ( register char *  p)
static void regc ( unsigned char  b)

Definition at line 668 of file regexp.cc.

static void reginsert ( char  op,
char *  opnd 
)

Definition at line 682 of file regexp.cc.

static void regtail ( char *  p,
char *  val 
)

Definition at line 709 of file regexp.cc.

static void regoptail ( char *  p,
char *  val 
)

Definition at line 739 of file regexp.cc.

hs_regexp* hs_regcomp ( const char *  exp)

Definition at line 203 of file regexp.cc.

static int regtry ( hs_regexp prog,
const char *  string 
)

Definition at line 835 of file regexp.cc.

static int regmatch ( char *  prog)

Definition at line 870 of file regexp.cc.

static int regrepeat ( char *  p)

Definition at line 1074 of file regexp.cc.

int hs_regexec ( const hs_regexp prog,
const char *  string 
)

Definition at line 776 of file regexp.cc.