#include <cstdio>#include <cctype>#include <cstdlib>#include <cstring>#include "regexp.h"#include "regmagic.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 | 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_regexp * | hs_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) |
| #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 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 NEXT | ( | p | ) | (((*((p)+1)&0377)<<8) + (*((p)+2)&0377)) |
| #define FAIL | ( | m | ) | { hs_regerror(m); return(NULL); } |
| #define ISMULT | ( | c | ) | ((c) == '*' || (c) == '+' || (c) == '?') |
| #define HASWIDTH 01 /* Known never to match null string. */ |
| STATIC char* regnext | ( | register char * | p | ) |