NEURON
regexp.cpp File Reference
#include <InterViews/regexp.h>
#include <ivstream.h>
#include <string.h>

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 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 FAIL(m)   { regerror(m); return(nil); }
 
#define ISMULT(c)   ((c) == '*' || (c) == '+' || (c) == '?')
 
#define META   "^$.[()|?+*\\"
 
#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. */
 

Functions

static regexpregcomp (const char *exp)
 
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 (char *p)
 
static void regc (char b)
 
static void reginsert (char op, char *opnd)
 
static void regtail (char *p, char *val)
 
static void regoptail (char *p, char *val)
 
static void regerror (const char *s)
 
static int regexec (regexp *prog, char *string)
 
static int regtry (regexp *prog, char *string)
 
static int regmatch (char *prog)
 
static int regrepeat (char *p)
 
char * FindNewline (char *s)
 
char * NextLine (char *s)
 
int UCHARAT (const char *p)
 This replaces a macro of the same name with some bit manipulation magic in it. More...
 

Variables

static const char * regparse
 
static int regnpar
 
static char regdummy
 
static char * regcode
 
static long regsize
 
static char * reginput
 
static char * regbol
 
static char ** regstartp
 
static char ** regendp
 

Macro Definition Documentation

◆ ANY

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

Definition at line 306 of file regexp.cpp.

◆ ANYBUT

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

Definition at line 308 of file regexp.cpp.

◆ ANYOF

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

Definition at line 307 of file regexp.cpp.

◆ BACK

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

Definition at line 310 of file regexp.cpp.

◆ BOL

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

Definition at line 304 of file regexp.cpp.

◆ BRANCH

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

Definition at line 309 of file regexp.cpp.

◆ CLOSE

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

Definition at line 317 of file regexp.cpp.

◆ END

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

Definition at line 303 of file regexp.cpp.

◆ EOL

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

Definition at line 305 of file regexp.cpp.

◆ EXACTLY

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

Definition at line 311 of file regexp.cpp.

◆ FAIL

#define FAIL (   m)    { regerror(m); return(nil); }

Definition at line 368 of file regexp.cpp.

◆ HASWIDTH

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

Definition at line 375 of file regexp.cpp.

◆ ISMULT

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

Definition at line 369 of file regexp.cpp.

◆ META

#define META   "^$.[()|?+*\\"

Definition at line 370 of file regexp.cpp.

◆ NEXT

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

Definition at line 352 of file regexp.cpp.

◆ NOTHING

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

Definition at line 312 of file regexp.cpp.

◆ OP

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

Definition at line 351 of file regexp.cpp.

◆ OPEN

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

Definition at line 315 of file regexp.cpp.

◆ OPERAND

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

Definition at line 353 of file regexp.cpp.

◆ PLUS

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

Definition at line 314 of file regexp.cpp.

◆ SIMPLE

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

Definition at line 376 of file regexp.cpp.

◆ SPSTART

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

Definition at line 377 of file regexp.cpp.

◆ STAR

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

Definition at line 313 of file regexp.cpp.

◆ WORST

#define WORST   0 /* Worst case. */

Definition at line 378 of file regexp.cpp.

Function Documentation

◆ FindNewline()

char* FindNewline ( char *  s)
inline

Definition at line 64 of file regexp.cpp.

◆ NextLine()

char* NextLine ( char *  s)
inline

Definition at line 69 of file regexp.cpp.

◆ reg()

static char * reg ( int  paren,
int *  flagp 
)
static

Definition at line 490 of file regexp.cpp.

◆ regatom()

static char * regatom ( int *  flagp)
static

Definition at line 662 of file regexp.cpp.

◆ regbranch()

static char * regbranch ( int *  flagp)
static

Definition at line 559 of file regexp.cpp.

◆ regc()

static void regc ( char  b)
static

Definition at line 793 of file regexp.cpp.

◆ regcomp()

static regexp * regcomp ( const char *  exp)
static

Definition at line 405 of file regexp.cpp.

◆ regerror()

static void regerror ( const char *  s)
static

Definition at line 1216 of file regexp.cpp.

◆ regexec()

static int regexec ( regexp prog,
char *  string 
)
static

Definition at line 884 of file regexp.cpp.

◆ reginsert()

static void reginsert ( char  op,
char *  opnd 
)
static

Definition at line 806 of file regexp.cpp.

◆ regmatch()

static int regmatch ( char *  prog)
static

Definition at line 976 of file regexp.cpp.

◆ regnext()

static char * regnext ( char *  p)
static

Definition at line 1199 of file regexp.cpp.

◆ regnode()

static char * regnode ( char  op)
static

Definition at line 770 of file regexp.cpp.

◆ regoptail()

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

Definition at line 861 of file regexp.cpp.

◆ regpiece()

static char * regpiece ( int *  flagp)
static

Definition at line 600 of file regexp.cpp.

◆ regrepeat()

static int regrepeat ( char *  p)
static

Definition at line 1155 of file regexp.cpp.

◆ regtail()

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

Definition at line 832 of file regexp.cpp.

◆ regtry()

static int regtry ( regexp prog,
char *  string 
)
static

Definition at line 942 of file regexp.cpp.

◆ UCHARAT()

int UCHARAT ( const char *  p)
inline

This replaces a macro of the same name with some bit manipulation magic in it.

The does not seem well-suited now, but it's not clear that it was before either.

Definition at line 364 of file regexp.cpp.

Variable Documentation

◆ regbol

char* regbol
static

Definition at line 876 of file regexp.cpp.

◆ regcode

char* regcode
static

Definition at line 386 of file regexp.cpp.

◆ regdummy

char regdummy
static

Definition at line 385 of file regexp.cpp.

◆ regendp

char** regendp
static

Definition at line 878 of file regexp.cpp.

◆ reginput

char* reginput
static

Definition at line 875 of file regexp.cpp.

◆ regnpar

int regnpar
static

Definition at line 384 of file regexp.cpp.

◆ regparse

const char* regparse
static

Definition at line 383 of file regexp.cpp.

◆ regsize

long regsize
static

Definition at line 387 of file regexp.cpp.

◆ regstartp

char** regstartp
static

Definition at line 877 of file regexp.cpp.