PostgreSQL Source Code
git master
|
#include "mb/pg_wchar.h"
Go to the source code of this file.
Data Structures | |
struct | regex_t |
struct | regmatch_t |
struct | rm_detail_t |
Macros | |
#define | _REGEX_H_ /* never again */ |
#define | REG_UBACKREF 000001 /* has back-reference (\n) */ |
#define | REG_ULOOKAROUND 000002 /* has lookahead/lookbehind constraint */ |
#define | REG_UBOUNDS 000004 /* has bounded quantifier ({m,n}) */ |
#define | REG_UBRACES 000010 /* has { that doesn't begin a quantifier */ |
#define | REG_UBSALNUM 000020 /* has backslash-alphanumeric in non-ARE */ |
#define | REG_UPBOTCH |
#define | REG_UBBS 000100 /* has backslash within bracket expr */ |
#define | REG_UNONPOSIX 000200 /* has any construct that extends POSIX */ |
#define | REG_UUNSPEC |
#define | REG_UUNPORT 001000 /* has numeric character code dependency */ |
#define | REG_ULOCALE 002000 /* has locale dependency */ |
#define | REG_UEMPTYMATCH 004000 /* can match a zero-length string */ |
#define | REG_UIMPOSSIBLE 010000 /* provably cannot match anything */ |
#define | REG_USHORTEST 020000 /* has non-greedy quantifier */ |
#define | REG_BASIC 000000 /* BREs (convenience) */ |
#define | REG_EXTENDED 000001 /* EREs */ |
#define | REG_ADVF 000002 /* advanced features in EREs */ |
#define | REG_ADVANCED 000003 /* AREs (which are also EREs) */ |
#define | REG_QUOTE 000004 /* no special characters, none */ |
#define | REG_NOSPEC REG_QUOTE /* historical synonym */ |
#define | REG_ICASE 000010 /* ignore case */ |
#define | REG_NOSUB 000020 /* don't care about subexpressions */ |
#define | REG_EXPANDED 000040 /* expanded format, white space & comments */ |
#define | REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */ |
#define | REG_NLANCH 000200 /* ^ matches after \n, $ before */ |
#define | REG_NEWLINE 000300 /* newlines are line terminators */ |
#define | REG_PEND 000400 /* ugh -- backward-compatibility hack */ |
#define | REG_EXPECT 001000 /* report details on partial/limited matches */ |
#define | REG_BOSONLY 002000 /* temporary kludge for BOS-only matches */ |
#define | REG_DUMP 004000 /* none of your business :-) */ |
#define | REG_FAKE 010000 /* none of your business :-) */ |
#define | REG_PROGRESS 020000 /* none of your business :-) */ |
#define | REG_NOTBOL 0001 /* BOS is not BOL */ |
#define | REG_NOTEOL 0002 /* EOS is not EOL */ |
#define | REG_STARTEND 0004 /* backward compatibility kludge */ |
#define | REG_FTRACE 0010 /* none of your business */ |
#define | REG_MTRACE 0020 /* none of your business */ |
#define | REG_SMALL 0040 /* none of your business */ |
#define | REG_OKAY 0 /* no errors detected */ |
#define | REG_NOMATCH 1 /* failed to match */ |
#define | REG_BADPAT 2 /* invalid regexp */ |
#define | REG_ECOLLATE 3 /* invalid collating element */ |
#define | REG_ECTYPE 4 /* invalid character class */ |
#define | REG_EESCAPE 5 /* invalid escape \ sequence */ |
#define | REG_ESUBREG 6 /* invalid backreference number */ |
#define | REG_EBRACK 7 /* brackets [] not balanced */ |
#define | REG_EPAREN 8 /* parentheses () not balanced */ |
#define | REG_EBRACE 9 /* braces {} not balanced */ |
#define | REG_BADBR 10 /* invalid repetition count(s) */ |
#define | REG_ERANGE 11 /* invalid character range */ |
#define | REG_ESPACE 12 /* out of memory */ |
#define | REG_BADRPT 13 /* quantifier operand invalid */ |
#define | REG_ASSERT 15 /* "can't happen" -- you found a bug */ |
#define | REG_INVARG 16 /* invalid argument to regex function */ |
#define | REG_MIXED 17 /* character widths of regex and string differ */ |
#define | REG_BADOPT 18 /* invalid embedded option */ |
#define | REG_ETOOBIG 19 /* regular expression is too complex */ |
#define | REG_ECOLORS 20 /* too many colors */ |
#define | REG_CANCEL 21 /* operation cancelled */ |
#define | REG_ATOI 101 /* convert error-code name to number */ |
#define | REG_ITOA 102 /* convert error-code number to name */ |
#define | REG_PREFIX (-1) /* identified a common prefix */ |
#define | REG_EXACT (-2) /* identified an exact match */ |
Typedefs | |
typedef long | regoff_t |
Functions | |
int | pg_regcomp (regex_t *, const pg_wchar *, size_t, int, Oid) |
int | pg_regexec (regex_t *, const pg_wchar *, size_t, size_t, rm_detail_t *, size_t, regmatch_t[], int) |
int | pg_regprefix (regex_t *, pg_wchar **, size_t *) |
void | pg_regfree (regex_t *) |
size_t | pg_regerror (int, const regex_t *, char *, size_t) |
regex_t * | RE_compile_and_cache (text *text_re, int cflags, Oid collation) |
bool | RE_compile_and_execute (text *text_re, char *dat, int dat_len, int cflags, Oid collation, int nmatch, regmatch_t *pmatch) |
#define REG_ADVANCED 000003 /* AREs (which are also EREs) */ |
Definition at line 105 of file regex.h.
Referenced by createTrgmNFA(), lexstart(), nameicregexeq(), nameicregexne(), nameregexeq(), nameregexne(), NIAddAffix(), parse_ident_line(), parse_re_flags(), parse_test_flags(), parseqatom(), pg_regcomp(), prefixes(), regexp_fixed_prefix(), texticregexeq(), texticregexne(), textregexeq(), textregexne(), textregexreplace_noopt(), and textregexsubstr().
#define REG_ADVF 000002 /* advanced features in EREs */ |
Definition at line 104 of file regex.h.
Referenced by lexescape(), lexstart(), next(), parse_test_flags(), pg_regcomp(), and prefixes().
#define REG_ASSERT 15 /* "can't happen" -- you found a bug */ |
Definition at line 153 of file regex.h.
Referenced by brackpart(), ccondissect(), cdissect(), checkmatchall_recurse(), compact(), crevcondissect(), parseqatom(), pickss(), removetraverse(), and repeat().
Definition at line 161 of file regex.h.
Referenced by pg_regerror().
#define REG_BADBR 10 /* invalid repetition count(s) */ |
Definition at line 149 of file regex.h.
Referenced by next(), parseqatom(), and scannum().
#define REG_BADOPT 18 /* invalid embedded option */ |
Definition at line 156 of file regex.h.
Referenced by prefixes().
#define REG_BADPAT 2 /* invalid regexp */ |
Definition at line 141 of file regex.h.
Referenced by prefixes().
#define REG_BADRPT 13 /* quantifier operand invalid */ |
Definition at line 152 of file regex.h.
Referenced by next(), parseqatom(), and prefixes().
#define REG_BOSONLY 002000 /* temporary kludge for BOS-only matches */ |
Definition at line 116 of file regex.h.
Referenced by next(), and parse_test_flags().
#define REG_CANCEL 21 /* operation cancelled */ |
Definition at line 159 of file regex.h.
Referenced by cdissect(), copyins(), copyouts(), mergeins(), miss(), moveins(), moveouts(), newarc(), newstate(), and range().
#define REG_DUMP 004000 /* none of your business :-) */ |
Definition at line 117 of file regex.h.
Referenced by parse_test_flags(), and pg_regcomp().
#define REG_EBRACE 9 /* braces {} not balanced */ |
#define REG_EBRACK 7 /* brackets [] not balanced */ |
#define REG_ECOLLATE 3 /* invalid collating element */ |
Definition at line 142 of file regex.h.
Referenced by brackpart(), and element().
#define REG_ECOLORS 20 /* too many colors */ |
Definition at line 158 of file regex.h.
Referenced by newcolor().
#define REG_ECTYPE 4 /* invalid character class */ |
Definition at line 143 of file regex.h.
Referenced by brackpart(), and lookupcclass().
#define REG_EESCAPE 5 /* invalid escape \ sequence */ |
Definition at line 144 of file regex.h.
Referenced by brenext(), lexdigits(), lexescape(), and next().
#define REG_EPAREN 8 /* parentheses () not balanced */ |
Definition at line 147 of file regex.h.
Referenced by parse(), and parseqatom().
#define REG_ERANGE 11 /* invalid character range */ |
Definition at line 150 of file regex.h.
Referenced by brackpart(), and range().
#define REG_ESPACE 12 /* out of memory */ |
Definition at line 151 of file regex.h.
Referenced by allocarc(), cclasscvec(), citerdissect(), clonesuccessorstates(), compact(), creviterdissect(), fixempties(), getcvec(), initcm(), moresubs(), newcolor(), newdfa(), newhicolorcols(), newhicolorrow(), newlacon(), newnfa(), newstate(), pg_regcomp(), pg_regexec(), pg_regprefix(), sortins(), sortouts(), subcoloronechr(), subcoloronerange(), and subre().
#define REG_ESUBREG 6 /* invalid backreference number */ |
Definition at line 145 of file regex.h.
Referenced by parseqatom().
#define REG_ETOOBIG 19 /* regular expression is too complex */ |
Definition at line 157 of file regex.h.
Referenced by allocarc(), cdissect(), cleartraverse(), clonesuccessorstates(), deltraverse(), duptraverse(), emptyreachable(), findconstraintloop(), lacon(), markcanreach(), markreachable(), newstate(), range(), removetraverse(), and subre().
#define REG_EXACT (-2) /* identified an exact match */ |
Definition at line 165 of file regex.h.
Referenced by findprefix(), pg_regprefix(), and regexp_fixed_prefix().
#define REG_EXPANDED 000040 /* expanded format, white space & comments */ |
Definition at line 110 of file regex.h.
Referenced by brenext(), lexstart(), next(), parse_re_flags(), parse_test_flags(), pg_regcomp(), prefixes(), and skip().
#define REG_EXPECT 001000 /* report details on partial/limited matches */ |
Definition at line 115 of file regex.h.
Referenced by build_test_match_result(), cfind(), find(), parse_test_flags(), and pg_regexec().
#define REG_EXTENDED 000001 /* EREs */ |
Definition at line 103 of file regex.h.
Referenced by lexstart(), next(), parse_re_flags(), parse_test_flags(), parseqatom(), pg_regcomp(), and prefixes().
#define REG_FAKE 010000 /* none of your business :-) */ |
Definition at line 118 of file regex.h.
Referenced by eclass(), and parse_test_flags().
#define REG_FTRACE 0010 /* none of your business */ |
Definition at line 129 of file regex.h.
Referenced by longest(), matchuntil(), parse_test_flags(), pg_regexec(), and shortest().
#define REG_ICASE 000010 /* ignore case */ |
Definition at line 108 of file regex.h.
Referenced by brackpart(), charclass(), charclasscomplement(), createTrgmNFA(), nameicregexeq(), nameicregexne(), onechr(), parse_re_flags(), parse_test_flags(), pg_regcomp(), prefixes(), regexp_fixed_prefix(), texticregexeq(), texticregexne(), and wordchrs().
#define REG_INVARG 16 /* invalid argument to regex function */ |
Definition at line 154 of file regex.h.
Referenced by pg_regcomp(), pg_regexec(), and pg_regprefix().
Definition at line 162 of file regex.h.
Referenced by pg_regerror().
#define REG_MIXED 17 /* character widths of regex and string differ */ |
Definition at line 155 of file regex.h.
Referenced by pg_regexec(), and pg_regprefix().
#define REG_MTRACE 0020 /* none of your business */ |
Definition at line 130 of file regex.h.
Referenced by parse_test_flags(), and pg_regexec().
#define REG_NEWLINE 000300 /* newlines are line terminators */ |
Definition at line 113 of file regex.h.
Referenced by lexstart(), parse_re_flags(), parse_test_flags(), pg_regcomp(), and prefixes().
#define REG_NLANCH 000200 /* ^ matches after \n, $ before */ |
Definition at line 112 of file regex.h.
Referenced by parse_re_flags(), parse_test_flags(), parseqatom(), pg_regcomp(), and prefixes().
#define REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */ |
Definition at line 111 of file regex.h.
Referenced by cbracket(), parse_re_flags(), parse_test_flags(), parseqatom(), pg_regcomp(), and prefixes().
#define REG_NOMATCH 1 /* failed to match */ |
Definition at line 140 of file regex.h.
Referenced by caltdissect(), cbrdissect(), ccondissect(), cdissect(), cfindloop(), check_ident_usermap(), citerdissect(), crevcondissect(), creviterdissect(), find(), findprefix(), pg_regexec(), pg_regprefix(), RE_wchar_execute(), regexp_fixed_prefix(), replace_text_regexp(), and test_re_execute().
#define REG_NOSUB 000020 /* don't care about subexpressions */ |
Definition at line 109 of file regex.h.
Referenced by next(), NIAddAffix(), parse_test_flags(), and pg_regexec().
#define REG_NOTBOL 0001 /* BOS is not BOL */ |
Definition at line 126 of file regex.h.
Referenced by longest(), matchuntil(), parse_test_flags(), and shortest().
#define REG_NOTEOL 0002 /* EOS is not EOL */ |
Definition at line 127 of file regex.h.
Referenced by longest(), matchuntil(), parse_test_flags(), and shortest().
#define REG_OKAY 0 /* no errors detected */ |
Definition at line 139 of file regex.h.
Referenced by cbrdissect(), ccondissect(), cdissect(), cfindloop(), CheckAffix(), citerdissect(), crevcondissect(), creviterdissect(), find(), pg_regexec(), RE_compile(), RE_compile_and_cache(), RE_wchar_execute(), replace_text_regexp(), test_re_compile(), and test_re_execute().
#define REG_PEND 000400 /* ugh -- backward-compatibility hack */ |
#define REG_PREFIX (-1) /* identified a common prefix */ |
Definition at line 164 of file regex.h.
Referenced by findprefix(), pg_regprefix(), and regexp_fixed_prefix().
#define REG_PROGRESS 020000 /* none of your business :-) */ |
Definition at line 119 of file regex.h.
Referenced by parse_test_flags(), and pg_regcomp().
#define REG_QUOTE 000004 /* no special characters, none */ |
Definition at line 106 of file regex.h.
Referenced by lexstart(), parse_re_flags(), parse_test_flags(), pg_regcomp(), and prefixes().
#define REG_SMALL 0040 /* none of your business */ |
Definition at line 131 of file regex.h.
Referenced by newdfa(), and parse_test_flags().
#define REG_STARTEND 0004 /* backward compatibility kludge */ |
#define REG_UBACKREF 000001 /* has back-reference (\n) */ |
Definition at line 60 of file regex.h.
Referenced by brenext(), build_test_info_result(), lexescape(), parse_test_flags(), and pg_regexec().
#define REG_UBBS 000100 /* has backslash within bracket expr */ |
Definition at line 67 of file regex.h.
Referenced by build_test_info_result(), next(), and parse_test_flags().
#define REG_UBOUNDS 000004 /* has bounded quantifier ({m,n}) */ |
Definition at line 62 of file regex.h.
Referenced by brenext(), build_test_info_result(), next(), and parse_test_flags().
#define REG_UBRACES 000010 /* has { that doesn't begin a quantifier */ |
Definition at line 63 of file regex.h.
Referenced by build_test_info_result(), next(), and parse_test_flags().
#define REG_UBSALNUM 000020 /* has backslash-alphanumeric in non-ARE */ |
Definition at line 64 of file regex.h.
Referenced by brenext(), build_test_info_result(), next(), and parse_test_flags().
#define REG_UEMPTYMATCH 004000 /* can match a zero-length string */ |
Definition at line 73 of file regex.h.
Referenced by analyze(), build_test_info_result(), and parse_test_flags().
#define REG_UIMPOSSIBLE 010000 /* provably cannot match anything */ |
Definition at line 74 of file regex.h.
Referenced by analyze(), build_test_info_result(), parse_test_flags(), pg_regexec(), and pg_regprefix().
#define REG_ULOCALE 002000 /* has locale dependency */ |
Definition at line 72 of file regex.h.
Referenced by build_test_info_result(), charclass(), charclasscomplement(), element(), lexescape(), next(), parse_test_flags(), and wordchrs().
#define REG_ULOOKAROUND 000002 /* has lookahead/lookbehind constraint */ |
Definition at line 61 of file regex.h.
Referenced by build_test_info_result(), next(), and parse_test_flags().
#define REG_UNONPOSIX 000200 /* has any construct that extends POSIX */ |
Definition at line 68 of file regex.h.
Referenced by brenext(), build_test_info_result(), lexescape(), next(), parse_test_flags(), prefixes(), and skip().
#define REG_UPBOTCH |
Definition at line 65 of file regex.h.
Referenced by build_test_info_result(), parse_test_flags(), and parseqatom().
#define REG_USHORTEST 020000 /* has non-greedy quantifier */ |
Definition at line 75 of file regex.h.
Referenced by build_test_info_result(), parse_test_flags(), and pg_regcomp().
#define REG_UUNPORT 001000 /* has numeric character code dependency */ |
Definition at line 71 of file regex.h.
Referenced by brackpart(), build_test_info_result(), lexescape(), and parse_test_flags().
#define REG_UUNSPEC |
Definition at line 69 of file regex.h.
Referenced by brenext(), build_test_info_result(), next(), parse_test_flags(), and parsebranch().
Definition at line 329 of file regcomp.c.
References assert, casecmp(), vars::cflags, guts::cflags, cleanst(), vars::cm, guts::cmap, cmp(), CNOERR, COLORLESS, compact(), vars::cv, vars::cv2, debug, DISCARD, dumpnfa(), EOS, vars::err, nfa::final, subre::flags, fprintf, freev(), vars::g, GUTSMAGIC, i, guts::info, nfa::init, initcm(), vars::lacons, guts::lacons, subre::latype, LATYPE_IS_AHEAD, lexstart(), guts::magic, makesearch(), MALLOC, markst(), newcvec(), newline(), newnfa(), vars::nfa, nfanode(), nfatree(), vars::nlacons, guts::nlacons, vars::nlcolor, NOTE, vars::now, guts::nsub, vars::nsubexp, vars::nsubs, vars::ntree, guts::ntree, numst(), okcolors(), optimize(), optst(), parse(), pg_set_regex_collation(), PLAIN, vars::re, regex_t::re_collation, regex_t::re_csize, regex_t::re_fns, regex_t::re_guts, regex_t::re_info, regex_t::re_magic, regex_t::re_nsub, REG_ADVANCED, REG_ADVF, REG_DUMP, REG_ESPACE, REG_EXPANDED, REG_EXTENDED, REG_ICASE, REG_INVARG, REG_NEWLINE, REG_NLANCH, REG_NLSTOP, REG_PROGRESS, REG_QUOTE, REG_USHORTEST, REMAGIC, guts::search, SEE, SHORTER, vars::spaceused, specialcolors(), generate_unaccent_rules::stdout, vars::stop, vars::sub10, subcolor(), vars::subs, vars::tree, guts::tree, vars::treechain, vars::treefree, VS, vars::wordchrs, and ZAPCNFA.
Referenced by NIAddAffix(), parse_ident_line(), RE_compile(), RE_compile_and_cache(), and test_re_compile().
size_t pg_regerror | ( | int | , |
const regex_t * | , | ||
char * | , | ||
size_t | |||
) |
Definition at line 60 of file regerror.c.
References rerr::code, rerr::explain, rerr::name, REG_ATOI, REG_ITOA, rerrs, sprintf, and unk.
Referenced by check_ident_usermap(), NIAddAffix(), parse_ident_line(), RE_compile(), RE_compile_and_cache(), RE_wchar_execute(), regexp_fixed_prefix(), replace_text_regexp(), test_re_compile(), and test_re_execute().
int pg_regexec | ( | regex_t * | , |
const pg_wchar * | , | ||
size_t | , | ||
size_t | , | ||
rm_detail_t * | , | ||
size_t | , | ||
regmatch_t | [], | ||
int | |||
) |
Definition at line 176 of file regexec.c.
References assert, cfind(), guts::cflags, cleanup(), guts::cmap, subre::cnfa, vars::details, vars::eflags, vars::err, find(), FREE, freedfa(), vars::g, i, guts::info, vars::ladfas, vars::lblastcp, vars::lblastcss, LOCALDFAS, LOCALMAT, MALLOC, guts::nlacons, vars::nmatch, guts::nsub, guts::ntree, pg_set_regex_collation(), vars::pmatch, vars::re, regex_t::re_collation, regex_t::re_csize, regex_t::re_guts, regex_t::re_magic, REG_ESPACE, REG_EXPECT, REG_FTRACE, REG_INVARG, REG_MIXED, REG_MTRACE, REG_NOMATCH, REG_NOSUB, REG_OKAY, REG_UBACKREF, REG_UIMPOSSIBLE, REMAGIC, vars::search_start, vars::start, generate_unaccent_rules::stdout, vars::stop, vars::subdfas, guts::tree, VS, and zapallsubs().
Referenced by check_ident_usermap(), CheckAffix(), RE_wchar_execute(), replace_text_regexp(), and test_re_execute().
void pg_regfree | ( | regex_t * | ) |
Definition at line 49 of file regfree.c.
References regex_t::re_fns.
Referenced by createTrgmNFA(), load_ident(), RE_compile_and_cache(), and test_regex().
Definition at line 46 of file regprefix.c.
References assert, guts::cmap, subre::cnfa, findprefix(), cnfa::flags, FREE, guts::info, MALLOC, MATCHALL, cnfa::nstates, pg_set_regex_collation(), regex_t::re_collation, regex_t::re_csize, regex_t::re_guts, regex_t::re_magic, REG_ESPACE, REG_EXACT, REG_INVARG, REG_MIXED, REG_NOMATCH, REG_PREFIX, REG_UIMPOSSIBLE, REMAGIC, and guts::tree.
Referenced by regexp_fixed_prefix().
Definition at line 137 of file regexp.c.
References Assert, pg_re_flags::cflags, CHECK_FOR_INTERRUPTS, cached_re_str::cre_collation, cached_re_str::cre_flags, cached_re_str::cre_pat, cached_re_str::cre_pat_len, cached_re_str::cre_re, ereport, errcode(), errmsg(), ERROR, free, i, malloc, Max, MAX_CACHED_RES, num_res, palloc(), pfree(), pg_mb2wchar_with_len(), pg_regcomp(), pg_regerror(), pg_regfree(), REG_OKAY, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Referenced by RE_compile_and_execute(), regexp_fixed_prefix(), setup_regexp_matches(), textregexreplace(), textregexreplace_noopt(), and textregexsubstr().
bool RE_compile_and_execute | ( | text * | text_re, |
char * | dat, | ||
int | dat_len, | ||
int | cflags, | ||
Oid | collation, | ||
int | nmatch, | ||
regmatch_t * | pmatch | ||
) |
Definition at line 343 of file regexp.c.
References RE_compile_and_cache(), and RE_execute().
Referenced by executeLikeRegex(), nameicregexeq(), nameicregexne(), nameregexeq(), nameregexne(), texticregexeq(), texticregexne(), textregexeq(), and textregexne().