LLVM 20.0.0git
|
#include <sys/types.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <stdlib.h>
#include "regex_impl.h"
#include "regutils.h"
#include "regex2.h"
#include "llvm/Config/config.h"
#include "llvm/Support/Compiler.h"
Go to the source code of this file.
Classes | |
struct | cclass |
struct | cname |
struct | parse |
Macros | |
#define | NPAREN 10 /* we need to remember () 1-9 for back refs */ |
#define | PEEK() (*p->next) |
#define | PEEK2() (*(p->next+1)) |
#define | MORE() (p->end - p->next > 0) |
#define | MORE2() (p->end - p->next > 1) |
#define | SEE(c) (MORE() && PEEK() == (c)) |
#define | SEETWO(a, b) (MORE2() && PEEK() == (a) && PEEK2() == (b)) |
#define | EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0) |
#define | EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0) |
#define | NEXT() (p->next++) |
#define | NEXT2() (p->next += 2) |
#define | NEXTn(n) (p->next += (n)) |
#define | GETNEXT() (*p->next++) |
#define | SETERROR(e) seterr(p, (e)) |
#define | REQUIRE(co, e) (void)((co) || SETERROR(e)) |
#define | MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e)) |
#define | MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e)) |
#define | MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e)) |
#define | EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd)) |
#define | INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos) |
#define | AHEAD(pos) dofwd(p, pos, HERE()-(pos)) |
#define | ASTERN(sop, pos) EMIT(sop, HERE()-pos) |
#define | HERE() (p->slen) |
#define | THERE() (p->slen - 1) |
#define | THERETHERE() (p->slen - 2) |
#define | DROP(n) (p->slen -= (n)) |
#define | DUPMAX 255 |
#define | REGINFINITY (DUPMAX + 1) |
#define | never 0 /* some <assert.h>s have bugs too */ |
#define | GOODFLAGS(f) ((f)&~REG_DUMP) |
#define | BACKSL (1<<CHAR_BIT) |
#define | N 2 |
#define | INF 3 |
#define | REP(f, t) ((f)*8 + (t)) |
#define | MAP(n) (((n) <= 1) ? (n) : ((n) == REGINFINITY) ? INF : N) |
Functions | |
static void | p_ere (struct parse *, int) |
static void | p_ere_exp (struct parse *) |
static void | p_str (struct parse *) |
static void | p_bre (struct parse *, int, int) |
static int | p_simp_re (struct parse *, int) |
static int | p_count (struct parse *) |
static void | p_bracket (struct parse *) |
static void | p_b_term (struct parse *, cset *) |
static void | p_b_cclass (struct parse *, cset *) |
static void | p_b_eclass (struct parse *, cset *) |
static char | p_b_symbol (struct parse *) |
static char | p_b_coll_elem (struct parse *, int) |
static char | othercase (int) |
static void | bothcases (struct parse *, int) |
static void | ordinary (struct parse *, int) |
static void | nonnewline (struct parse *) |
static void | repeat (struct parse *, sopno, int, int) |
static int | seterr (struct parse *, int) |
static cset * | allocset (struct parse *) |
static void | freeset (struct parse *, cset *) |
static int | freezeset (struct parse *, cset *) |
static int | firstch (struct parse *, cset *) |
static int | nch (struct parse *, cset *) |
static void | mcadd (struct parse *, cset *, const char *) |
static void | mcinvert (struct parse *, cset *) |
static void | mccase (struct parse *, cset *) |
static int | isinsets (struct re_guts *, int) |
static int | samesets (struct re_guts *, int, int) |
static void | categorize (struct parse *, struct re_guts *) |
static sopno | dupl (struct parse *, sopno, sopno) |
static void | doemit (struct parse *, sop, size_t) |
static void | doinsert (struct parse *, sop, size_t, sopno) |
static void | dofwd (struct parse *, sopno, sop) |
static void | enlarge (struct parse *, sopno) |
static void | stripsnug (struct parse *, struct re_guts *) |
static void | findmust (struct parse *, struct re_guts *) |
static sopno | pluscount (struct parse *, struct re_guts *) |
int | llvm_regcomp (llvm_regex_t *preg, const char *pattern, int cflags) |
Variables | |
static struct cclass | cclasses [] |
static struct cname | cnames [] |
static char | nuls [10] |
#define BACKSL (1<<CHAR_BIT) |
#define GOODFLAGS | ( | f | ) | ((f)&~REG_DUMP) |
#define INF 3 |
#define MAP | ( | n | ) | (((n) <= 1) ? (n) : ((n) == REGINFINITY) ? INF : N) |
#define N 2 |
#define NPAREN 10 /* we need to remember () 1-9 for back refs */ |
#define REP | ( | f, | |
t | |||
) | ((f)*8 + (t)) |
Definition at line 1192 of file regcomp.c.
References assert(), cset::hash, if(), cset::mask, cset::multis, cset::ptr, REG_ESPACE, SETERROR, and cset::smultis.
Referenced by p_bracket().
|
static |
Definition at line 1049 of file regcomp.c.
References assert(), othercase(), and p_bracket().
Referenced by ordinary().
Definition at line 1422 of file regcomp.c.
References g(), isinsets(), and samesets().
Referenced by llvm_regcomp().
Definition at line 1447 of file regcomp.c.
References assert(), enlarge(), and HERE.
Referenced by p_ere_exp(), p_simp_re(), and repeat().
Definition at line 1253 of file regcomp.c.
Referenced by freezeset(), and p_bracket().
Definition at line 1275 of file regcomp.c.
References CHIN, for(), freeset(), and cset::hash.
Referenced by p_bracket().
|
static |
int llvm_regcomp | ( | llvm_regex_t * | preg, |
const char * | pattern, | ||
int | cflags | ||
) |
Definition at line 293 of file regcomp.c.
References categorize(), re_guts::cflags, EMIT, findmust(), g(), GOODFLAGS, llvm_regfree(), MAGIC1, MAGIC2, NC, NPAREN, OEND, OUT, p_bre(), p_ere(), p_str(), pluscount(), llvm_regex::re_endp, llvm_regex::re_g, llvm_regex::re_magic, llvm_regex::re_nsub, REG_ASSERT, REG_ESPACE, REG_EXTENDED, REG_INVARG, REG_NOSPEC, REG_PEND, REGEX_BAD, SETERROR, stripsnug(), and THERE.
Referenced by llvm::Regex::Regex().
Definition at line 1338 of file regcomp.c.
References llvm_strlcpy(), cset::multis, REG_ESPACE, SETERROR, and cset::smultis.
Definition at line 1378 of file regcomp.c.
References assert(), and cset::multis.
Referenced by p_bracket().
Definition at line 1365 of file regcomp.c.
References assert(), and cset::multis.
Referenced by p_bracket().
|
static |
Definition at line 1091 of file regcomp.c.
References assert(), and p_bracket().
Referenced by p_ere_exp(), and p_simp_re().
|
static |
Definition at line 1072 of file regcomp.c.
References bothcases(), EMIT, OCHAR, othercase(), and REG_ICASE.
Referenced by p_bracket(), p_ere_exp(), p_simp_re(), and p_str().
|
static |
Definition at line 1031 of file regcomp.c.
References assert().
Referenced by bothcases(), ordinary(), and p_bracket().
Definition at line 941 of file regcomp.c.
References cclasses, CHadd, cclass::chars, MCadd, MORE, cclass::multis, cclass::name, NEXT, PEEK, REG_ECTYPE, and SETERROR.
Referenced by p_b_term().
Definition at line 1004 of file regcomp.c.
References cnames, cname::code, MORE, cname::name, NEXT, REG_EBRACK, REG_ECOLLATE, SEETWO, and SETERROR.
Referenced by p_b_eclass(), and p_b_symbol().
Definition at line 974 of file regcomp.c.
References CHadd, and p_b_coll_elem().
Referenced by p_b_term().
Definition at line 986 of file regcomp.c.
References EATTWO, GETNEXT, MORE, p_b_coll_elem(), REG_EBRACK, REG_ECOLLATE, REQUIRE, and value.
Referenced by p_b_term().
Definition at line 878 of file regcomp.c.
References CHadd, EAT, EATTWO, MORE, MORE2, NEXT, NEXT2, p_b_cclass(), p_b_eclass(), p_b_symbol(), PEEK, PEEK2, REG_EBRACK, REG_ECOLLATE, REG_ECTYPE, REG_ERANGE, REQUIRE, SEE, and SETERROR.
Referenced by p_bracket().
|
static |
Definition at line 797 of file regcomp.c.
References allocset(), assert(), CHadd, CHIN, CHsub, EAT, EMIT, firstch(), freeset(), freezeset(), mccase(), mcinvert(), MORE, cset::multis, MUSTEAT, nch(), NEXTn, OANYOF, OBOW, OEOW, ordinary(), othercase(), p_b_term(), PEEK, REG_EBRACK, REG_ICASE, REG_NEWLINE, and SEETWO.
Referenced by bothcases(), nonnewline(), p_ere_exp(), and p_simp_re().
|
static |
|
static |
Definition at line 776 of file regcomp.c.
References DUPMAX, GETNEXT, MORE, PEEK, REG_BADBR, and REQUIRE.
Referenced by p_ere_exp(), and p_simp_re().
|
static |
|
static |
Definition at line 436 of file regcomp.c.
References AHEAD, assert(), ASTERN, dupl(), EAT, EMIT, g(), GETNEXT, HERE, INSERT, LLVM_FALLTHROUGH, MORE, MORE2, MUSTEAT, NEXT, nonnewline(), NPAREN, O_BACK, O_CH, O_PLUS, O_QUEST, OANY, OBACK_, OBOL, OCH_, OEOL, OLPAREN, OOR1, OOR2, OP, OPLUS_, OQUEST_, ordinary(), ORPAREN, p_bracket(), p_count(), p_ere(), PEEK, PEEK2, REG_BADBR, REG_BADRPT, REG_EBRACE, REG_EESCAPE, REG_EMPTY, REG_EPAREN, REG_ESUBREG, REG_NEWLINE, REGINFINITY, repeat(), REQUIRE, SEE, SETERROR, THERE, THERETHERE, USEBOL, and USEEOL.
Referenced by p_ere().
|
static |
Definition at line 660 of file regcomp.c.
References assert(), ASTERN, BACKSL, dupl(), EAT, EATTWO, EMIT, g(), GETNEXT, HERE, INSERT, LLVM_FALLTHROUGH, MORE, NEXT, nonnewline(), NPAREN, O_BACK, O_PLUS, O_QUEST, OANY, OBACK_, OLPAREN, OP, OPLUS_, OQUEST_, ordinary(), ORPAREN, p_bracket(), p_bre(), p_count(), PEEK, REG_BADBR, REG_BADRPT, REG_EBRACE, REG_EESCAPE, REG_EPAREN, REG_ESUBREG, REG_NEWLINE, REGINFINITY, repeat(), REQUIRE, SEETWO, and SETERROR.
Referenced by p_bre().
|
static |
Definition at line 611 of file regcomp.c.
References GETNEXT, MORE, ordinary(), REG_EMPTY, and REQUIRE.
Referenced by llvm_regcomp().
|
static |
|
static |
Definition at line 1569 of file regcomp.c.
References g(), REG_ESPACE, and SETERROR.
Referenced by llvm_regcomp().
|
static |
Referenced by p_b_cclass().
|
static |
Referenced by p_b_coll_elem().