27const unsigned TRegexp::maxpat=128;
44void TRegexp::copy_pattern(
const TRegexp &
r)
47 memcpy( the_pattern,
r.the_pattern, maxpat );
51void TRegexp::gen_pattern(
const tchar * str)
92 const tchar * s = str.c_str();
100 return static_cast<size_t>(-1);
125#define CCLEND _T(']')
127#define CLOSURE _T('*')
128#define PCLOSE _T('+')
147#define IS_ACTION(x) ((x)&0x80)
161#define ADVANCE(pat) (pat += (*pat == (pattern)M_CCL) ? (MAPSIZE+1) : 1)
168#define SETBIT(b,map) ((map)[((b) & 0x7f) >>3] |= pattern(1 << ((b) & 0x07)) )
169#define TSTBIT(b,map) ((map)[((b) & 0x7f) >>3] & (1<< ((b) & 0x07)) )
179 static int hex2bin(
int);
182 static int oct2bin(
int);
224 if (cur >= &
pat[maxpat - 1])
315 if (*
src !=
_T(
'-')) {
359 if (*str ==
_T(
'\0')) {
428 while (*str && omatch(&str,
pat,
start)) { }
442 for (;
bocl <= str; --str) {
470 return (std::max(
start, str));
525#define ISHEXDIGIT(x) (_istdigit(x) \
526 || (_T('a')<=(x) && (x)<=_T('f')) \
527 || (_T('A')<=(x) && (x)<=_T('F')) )
529#define ISOCTDIGIT(x) (_T('0')<=(x) && (x)<=_T('7'))
531static int hex2bin(
int c )
539static int oct2bin(
int c )
544 return ( ((
c)-
_T(
'0')) & 0x7 );
571 if( **s !=
_T(
'\\') )
576 case _T(
'\0'):
rval =
_T(
'\\');
break;
577 case _T(
'B'):
rval =
_T(
'\b') ;
break;
578 case _T(
'F'):
rval =
_T(
'\f') ;
break;
579 case _T(
'N'):
rval =
_T(
'\n') ;
break;
580 case _T(
'R'):
rval =
_T(
'\r') ;
break;
581 case _T(
'S'):
rval =
_T(
' ') ;
break;
582 case _T(
'T'):
rval =
_T(
'\t') ;
break;
583 case _T(
'E'):
rval =
_T(
'\033');
break;
594 rval = hex2bin( *(*s)++ );
598 rval |= hex2bin( *(*s)++ );
602 rval |= hex2bin( *(*s)++ );
612 rval = oct2bin( *(*s)++ );
615 rval |= oct2bin( *(*s)++ );
619 rval |= oct2bin( *(*s)++ );
#define PRECONDITION(condition)
This class represents regular expressions.
TRegexp & operator=(const TRegexp &r)
StatVal status() noexcept
StatVal
StatVal enumerates the status conditions returned by TRegexp::status.
@ OK
Means the given regular expression is legal.
size_t find(const tstring &s, size_t *len, size_t start=0) const
Object Windows Library (OWLNext Core)
int makepat(const tchar *exp, PatternType *pat, size_t maxpattern)
const tchar * patcmp(const tchar *, const pattern *, const tchar *)
const tchar * matchs(const tchar *str, const PatternType *pat, tchar **startpat)
General definitions used by all ObjectWindows programs.